swing

Java Swing: How to remove an anonymous ActionListener from a component

I created an array of JButtons with anonymous ActionListeners and under certain conditions I want to remove all the ActionListeners, but the .removeActionListeners method requires an ActionListener as an argument. How would I go about removing the Action Listeners? for (int i=0; i < button.length; i++){ button[i] = new JButton(...

how to change knob's image of Jslider on mouseover and mouse pressed?

Hi All, I need to change knob's image of Jslider on mouse over and mouse pressed over it. Please tell me how can i do this. Thanks Jyoti ...

Java Swing. Windows in front launched from JDialog

Hi! The thing I want to implement is the next UI hierarchy in my Swing application. Main Window (JFrame) Modal dialog (JDialog) in front of this window. It's opened by clicking on the button in main window. The set of windows in front of modal dialog (2). They should be independent from each other and non-blocking for modal jdialog (2)...

Tree in scala swing

I want to use a tree in my Scala swing application, but the component isn't available in the API. Does a wrapper of JTree exists ? If not, do you have any advice for making it ? Thanks ...

how to have jslider's track below the knob's image and how to fill colours in track on Slider's knob movement?

HI All, i need to put jSlider's track below the knob's image and fill different colours in track on Slider's knob movement. Please explain with some code snippets. Thanks Jyoti ...

identifying double click in java

I want to know how can we perform action when mouse is double clicked in a component. ...

Why does a partially hidden JFrame not repaint properly on Linux when switching between virtual desktops

Hi, we have problems with Java 6 applications that do not properly refresh when switching virtual desktops. The problem so far has been reproduced on Fedora 11 and 13 with GNOME and Suse SLES 10 with KDE. I use the following test case to reproduce the problem: import java.awt.Color; import java.awt.EventQueue; import java.awt.event.Acti...

Swing rich client in a multi tier context

We're in the analysis/early design phase of a future Swing application where persistance is provided by a database (probably an alternative between Oracle and mySql depending on the customer's money). Basically, the application will feature two kinds of modules : One "admin" subsystem to feed and maintain a set of referential data ; X...

JTextArea Real Time Spell Checker

I need a good spell checker library for Java that can spell check a JTextArea (or any JTextComponent) in real time. That is, it should have a wavy red underline appear under text while the user is typing. It needs to be able to list all the available word replacements by left clicking (yes, left clicking) the word. If not possible, ri...

how to handle bad file selection for image display in swing

I am learning Swing and wrote an app that lets user select an image file and displays it on a JPanel. It works, but I want to handle situations when user doesn't select any file user selects a non image file In these cases I want to clear the JPanel and show an error message on a text area. I tried to do this as below.But I am not s...

How to tame the X on the JOptionPane Dialog boxes?

Also, right now whenever I click the 'X" button on top right, the dialog boxes behaves as if I clicked OK (on messages) or YES (on questions). When the user clicks the X, I want DO_Nothing. In the code below, when i click on the X on the dialog box, it pops out the 'eat!'. Apparently, the X is acting as 'YES' Option, which it should no...

Java application code structure

My Java application is not very big, but I would like to do it the "right way". Looking for suggestions to not make a big mess... I am using Swing, the Swing Application Framework and H2 database. It is a single frame application with different tabs. Most tabs will reflect some aspects of the data in the database. Some of them will be ...

Java JTextArea hightliting text with a bold font

Hello! I need several words to be highlighted in a String while appending it to a JTextArea. So that I try this: jta.append("<html> <b>Termination time : </b></html>" + CriterionFunction.estimateIndividual_top(individual) + "\n"); Where jta is a JTextArea. The output I get is: <html> <b>Termination time : </...

JTextPane appending a new string

Hello! In an every article the answer to a question "How to append a string to a JEditorPane?" is something like jep.setText(jep.getText + "new string"); I have tried this: jep.setText("<b>Termination time : </b>" + CriterionFunction.estimateIndividual_top(individual) + " </br>"); jep.setText(jep.getText() +...

How to use glassPane to create transparent window?

Okay, so I want to make a Java JFrame that is transparent, but than has a the glassPane not transparent so I can make my own style of windows. can this be done? ...

Swing JFrame Responding to Native Window On Close Event

I have a Swing application which consists of a single JFrame set to Always On Top. When running under Windows, I use the following code to open the the native default email client and browser respectively: Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + Utils.formatMailtoUrl(to, subject, body)); Runtime.getRuntime()...

how to stop adding tabbed panel within a tabbed panel in Netbean IDE 6.8.

how to stop adding tabbed panel within a tabbed panel in Netbean IDE 6.8. i want to add a frame in a tabbed panel but whenever i do, it creates another tabbed panel frame in that main tab. what should i do? plz help thanks. ...

Drawing non-transparent content on transparent window

So I'm trying to draw a solid red oval on a transparent window. I later want to do something more complex with multiple shapes, so using setWindowShape isn't what I'm looking for. This is the code I'm using so far: import java.awt.*; import javax.swing.*; public class JavaDock extends JFrame{ public JavaDock(){ super("This...

What plugin it is better to use for build swing interface using Eclipse?

What plugin it is better to use for build swing interface using Eclipse? ...

Prevent Java from repainting the content of a JPanel while updating

I have a JPanel which contains a lot of child components. While updating\adding new components to the parent JPanel I'd like to prevent it from repainting, how can this achieved? ...