swing

Updating JTree nodes background color at runtime.

Hi, I need to change tree nodes color when business logic updates model, wait 1 second, and then change its color back. Basically I would like to create similar thing like here http://stackoverflow.com/questions/1664924/changing-jlist-row-color-at-runtime, but for JTree. So I could use a similar technique,but I also wont to change anc...

Java Issue with Tree Selection

In my program, I have 2 JTrees and there is a common treeselection listener for both. The problem happens when I select a node in the first tree and then immediately select a node in the second tree.Now if I were to go back and select the same node in the first tree that was initially selected, nothing happens. How do I solve this? Is th...

Really quick and dirty solution for embedding webkit in a Swing UI?

Hi, I am looking for a really quick and dirty solution for embedding webkit in a Swing application. What I am looking for is a way to implement a panel that contains a webkit browser running some JavaScript that will be able to do one or more of the following: Call a Java function of the containing application Send JSON objects to the...

How to make swing components not resizable

Hi, I'm trying to make some components inside a JSrollPane unresizable, because content inside can grow dynamically and I must prevent it from growing over a predefined size. My approach so far is this one: scrollPane(constraints:BL.CENTER, size:[500,200], maximumSize:[500,200]){ panel(background:Color.WHITE, border:BF.createTitled...

Setting three button accelerator key hot keys in Java (OSX)

I am trying to change a few hot-keys in the java application I am wokring on and it seems that the system I am using may not work with three button key combinations. We currently have a JMenuItem item and we set the hotkey with a call like this: menuItem.setAccelerator(getAcceleratorKey(accelerator)); And here is the getAcceleratorKe...

Java Problem with the clearselection() method

I have 2 trees in my program. Iam using JTree's clearselection() method to clear the selection in 1 tree when something in the other tree is selected. The main code is something like this:(inside a valueChanged event listener and tree being the one on which the current selection has been triggered) if ( tree == tree1 ){ tree2.cle...

JList item : changing the vertical alignement

My application is using a JList to display numerical values. Here is the default display : +-----------------+ |value 1 | |value 2 | |value 3 | | | | | | | | | +-----------------+ I would like to change the vertical alignement, so that the valu...

how can i insert a image in swing JList menu?

this is my code: URL imageUrl = status.getUser().getProfileImageURL(); ImageIcon tivitImage = new ImageIcon(imageUrl); listModel.addElement(tivitImage.getImage()); // maybe this part is wrong ...

Java Beans - creating an inspector window

I'm wondering whether there is an existing Java class that, given a Java bean, uses introspection to find all the publicly modifiable fields, and displays them using default PropertyEditors. I see a bunch of information about BeanInfo, PropertyEditor, Bean Customizers, but nowhere can I find actual examples. Basically I want the functi...

How do I retrieve the attribute of an element using Swing's HTMLEditorKit.ParserCallback?

I am extending HTMLEditorKit.ParserCallback to parse HTML. I am matching on a certain element type in an overridden method like this: @Override public void handleStartTag(Tag t, MutableAttributeSet a, int pos) { if (Tag.DIV.equals(t)) { String id = (String) a.getAttribute("id"); String clazz = (String) a.getAttribute...

How to create an overlay window in Java?

I'm trying to create a HUD style display for a foreign application. To do this, I'd need to make a transparent overlay window, that would be placed on top of the window of the foreign application. The overlay window should allow me to place widgets and draw text on it. Events should get forwarded to the underlying window, if they happen...

Java .getText vs. Hard Coded String not returning the same results

I am completely stumped with this one . . . If I call the function below with the following: Search(SearchTextField.getText()); // (Fiberglass was entered) Search("Fiberglass"); // hardcoded I get the following results: Fiberglass 10 Not Here Fiberglass 10 String found! Same String is passed with the same length, different results...

JButton in Java swing

Is there a way to check whether a button is enabled is set to true or false through code? ...

Displaying a list of items with Swing from bottom to top

I need to display items in a list (read-only), but instead of the default top-to-bottom way of displaying a list, I need to display it bottom-to-top. +-----------------+ | | | | | | | | | value 3| | value 2| | value 1| +-----------------+ If a n...

Swing won't trigger mouseEntered/mouseExited properly after mouse wheel events?

I have an issue where Swing (in Java 1.6, Windows) doesn't seem to trigger mouseEntered and mouseExited events the way I want it to. I have an application where I wish to have a number of JPanels stacked vertically in a JScrollPane, and that they should be highlighted with a different colour when the mouse is over them. Simple enough pro...

Changing Font Size and leaving space between button in a JOptionPane

The text in my JOptionPanes are way to small I was wondering how I could change the font of the text inside the pane. Also, I would like to be set a space between two buttons. Something like |Canecl| |DoneSave| |Save| ...

Create a setup-frame in Java

My problem is the following: I have a Java application, and I would like to create a setup form on it, so i can declare some variables. How can it be done? And when the setup form is on focus, it should be disabled to perform actions on the main form. Thanks for any help. hectai ...

How to code startup tips to be easily localized

I'm writing a new Java 6 Swing application and want to have a "Show tips at start-up" feature. I've done this before, but never with localization in mind. In the past, my tips dialog used an XML file to hold the tips, but I'm afraid this will make things difficult when it comes time to translate these tips into different languages. I'v...

Java Menu issue

I have a menu with a few JCheckBoxMnuItems. How do I ensure that the Menu stays open until I have done all my selections (i.e. checked the menuitems) and does not close on just clicking one of them? ...

JTabbedPane: icon on left side of tabs

hello i am using the nimbus look-and-feel and have a tabbedpane with an icon and text. now the icon appears on the right side of the text, while i would like to have it on the left side. also i would like to add some spacing between the icon and the text. thanks! ...