Swing Section Index | Page 7
Check out the jGuru Tools FAQ.
Check out the jGuru AWT FAQ.
Check out the jGuru Threads FAQ.
How portable is Swing vs AWT Do I get the same degree of GUI portability with Swing than with AWT?. How dependent is Swing on its ansestor AWT?
Is it possible to make a JComboBox or a JListBox whose items cascade? (Similar to the way nested menus cascade.)
Have a look at the following link: http://www2.gol.com/users/tame/swing/examples/JMenuExamples1.html Although the example is for JComboBox, it may give you some idea for applying it to JList too. more
The Dimension class is a representation of the size of an AWT or Swing component. It's returned from several methods, such as comp.getSize(); comp.getPreferredSize(); comp.getMaximumSize...more
How do you drag and drop one row in a JTable to another… How do you drag and drop one row in a JTable to another location in the JTable.
We can do this by creating a library of drag and drop-enabled Swing components. Issues for drag and drop components Starting the drag operation Drag-under feedback Drag-over feedback The drop Tr...more
JTabbedPane with vertical text in tab Is there a way to have the text in a JTabbedPane's tabs displayed vertically ?
Re: JTabbedPane with vertical text in tab Not out of the box. You may be able to do something like this - V e r t i c a l using html's syntax. At least that works with JLabels.more
To make a copy/paste action as general as possible in an application - what would be the most effective way to get hold of the current selection without knowing which component owns the focus/the selected area?
Yes. That is how all the Actions work in the JTextComponent. The methods are in javax.swing.text.TextAction. Here is the code snippet - /** * Determines the component to use for the act...more
How can I load large files (eg log files greater than… How can I load large files (eg log files greater than 80 MB) in JEditorPane?
How can I load large files (eg log files greater than... You can use paging. It means, in general terms, split your log file in numbered blocks (or sections). Each block has a given index. For ...more
Yes. TreeNode root = ...; JTree tree1 = new JTree(root); JTree tree2 = new JTree(); tree2.setModel(tree1.getModel()); If you want to share the selection also you will have to share the TreeSel...more
Menu Key Listener is used to access the Menu item using the short key You can do this by this also JMenuItem item = new JMenuItem("Item"); item.setAccelerator(KeyStroke.getKeyStroke...more
Are there any good (and possibly free) ways to crosscompile a Java app (using Swing) into a standalone Java or C++ application?
I believe there are free GNU tools for that purpose, and quite a few (expensive) commercial ones. GNU Java is at http://gcc.gnu.org/java/ or you could browse the Google web directory for java dev...more
You will have to write a custom subclass of javax.swing.text.StyledEditorKit and also implement the javax.swing.text.ViewFactory. Please look into the javax.swing.text.html.HTMLEditorKit and t...more
See http://codeguru.earthweb.com/java/articles/124.shtml http://codeguru.earthweb.com/java/articles/126.shtml http://codeguru.earthweb.com/java/articles/125.shtmlmore