swing

Why/When ComponentListener.componentShown() get invoked ?

Why this code never prints "Hello2" ? public class Test4 { public static void main(String[] args) { JFrame f = new JFrame(); JPanel p = new JPanel(); f.getContentPane().add(p); JLabel x = new JLabel("Hello"); p.add(x); p.addComponentListener(new ComponentListener() { p...

Default font for Swing text

Does the text in Swing components have a default font? In particular, what about tab labels on JTabbedPanes? I'm working on a mock-up of a GUI made with Swing and want it to blend it with a screen image I grabbed of a Swing app. ...

JTable Row Header implementation

Hi, I wanna create a JTable with a row header. This question seems simple and I could find a lot of tips on google search. Nevertheless, everything I have found were tips of how make a column mimics the real header. Although good, it comes with the problem of that the look and feel can not be applied very well. In my program, I tryed th...

Is there a way to attatch a css file to a jEditorPane?

Simple enough question: I have a string containing HTML that is being handed off to a JEditorPane for user consumption. Can I attach a CSS file (or string containing CSS rules) to allow for more specific styling of the text? ...

Help making a JTree with a JCheckBox

Hi -- I have an unusual situation where I need to have a JTree with each node containing 2 checkboxes and a label (with the ability to add a listener to tell when any of the potential checkboxes are checked). I also need the root node to have the same layout (which I'm assuming means creating a JPanel with 2 JCheckBoxes and a JLabel), wi...

Java tool tip not displaying.

The program I am writing has a Swing GUI and several of the components have Tooltips. These are all on JButton, JCheckBox and JRadioButton components, they are set using the setToolTipText method and all work perfectly. I have just tried to add one to a custom component that extends JPanel using the same method and no tool tip appears. T...

Dynamic resize of Layout Manager areas

In which Swing layout manager it is possible to change layout areas programmatically? And how to do this with lowest cost? I have to create component with functionality similar to JSplitPane but with three panels from scratch. One of the moments is to Expand/Collapse one of the panels after clicking oneTouchExpandable button on the divi...

JTree updates in realtime?

I'm looking for a threaded solution to updating my JTree every second. Basically, I'm... Importing an external file Creating an Enumeration off of that Building the tree off the enumeration The external file can change at random, and the data in the tree needs to represent this change in a somewhat reasonable time manner. How would ...

Library to embed 3D view in a swing app ?

I'm currently searching for a 3d library that I could embed in a Swing application. This library doesn't necessarily have to be a huge thing as I mainly intend to give a 3D representation of some shapes, and certainly rotate around them. My main concern is to get something as easy to set up and to deploy as possible. Do you have any c...

How to draw dotted gridlayout cell border using swing ?

When i am declaring rows and columns to my gridlayout.eg: 3x2 (3 rows and 2 cols).I have to get a skeletal view of these rows and columns.Like a dotted rectangles.How can we achieve this by using swing ? regards Mathan ...

How does Swing handle consecutive changes to the same component?

I'm a little confused about the Swing painting model. Suppose that I have a JComponent comp, and I do something like: c.setBackground(Color.RED); c.setBackground(Color.YELLOW); Obviously, the end result is that the color is yellow. How does Swing handle this? Does the first call trigger an immediate repaint so there'll be a short f...

jscrollpane to scrolling a panel

hi i have to writing an applet, in left side i must use an panel to contain a list of vehicles that can be a list of buttons,what is the problem, number of the vehicles are not given !!! so, i need to scrolling panel when number of vehicles is too much, i do this for jframe, but it didn't work correct with panel, please help me with ...

What are good ways to keep GridBagConstraints under control?

I'm somewhat new to Swing programming, and I find that as much as I love the power of GridBagLayout, if you've got a lot of components, there are lots of lines of code just setting up the constraints for the layout. What are some good ways to keep this under control, besides using a visual editor? ...

How to remap a keyboard key using Java Swing?

how to remap a key in keyboard using java so that i could give new meaning to a key ...

Does anyone use the "swingx" extensions to Swing?

I've seen "swingx" mentioned and referred to here. However, every time I try to visit the site: http://swinglabs.org/ It's down! Is this still an active, viable project? Or is it outdated and abandoned? ...

Dependent columns in a JTable.

Hie! I have a JTable. Columns of this JTable are rendered by JComboBox. I would like to be able to change items of column 2 on the basis of values selected in column 1. For example if the user selects Microsoft in column 1, then in column 2 he/she can select ado, wpf, etc. Is it possible ? If it is possible, than which events shoul...

Java - Is it possible to put a JLayeredPane inside JScrollPane ?

Hi all, when I try putting my JLayeredPane inside a JScrollPane I get a blank window (with white background) instead of the content I am trying to render (it could be an image, a button, a canvas). Does anyone know of a problem with layout managers that might cause it? Is it possible? EDIT: thanks to camickr help, I can now put a JLaye...

How to know when a user has really released a key in Java?

(Edited for clarity) I want to detect when a user presses and releases a key in Java Swing, ignoring the keyboard auto repeat feature. I also would like a pure Java approach the works on Linux, Mac OS and Windows. Requirements: When the user presses some key I want to know what key is that; When the user releases some key, I want to ...

Java applications with Windows 7 - are there compatibility concerns?

Hi, with some fuzz around Windows 7, does somebody have experiences with Java compatibility with Windows 7? Should this be a concern or do the programs probably work ok? I'd be especially interested if somebody has experiences with Swing applications? The versions available seem to be beta versions so they won't provide perfect basis ...

Who loads javax.swing.* classes in Equinox osgi container?

I read some equinox code and doc. I came to understand that, at present, only class loading for java.* packages are delegated to the parent classloader(given that i have not modified org.osgi.bootdelegation property, which by the way seems to be null). Then who is loading the javax.swing.* classes. I have not mentioned it anywhere in the...