swing

Swing invokeLater never shows up, invokeAndWait throws error. What can I do?

I have this code: try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { try { dialog.handleDownload(); } catch (IOException io) { io.printStackTrace(); } } }); } catch(Exception io) { io.printStackTrace(); } in the handleDownload I'm reading ...

Fading Indicator message in Java

How to/What is a good library, to create a fading indicator message in Java like that of Outlook when you get a message, or Ubuntu/Gnome when you've connected to a network? ...

How to draw a diary in swt

Hey, I am searching for a good mode to develop a application which shows 7 days and 24 hours (weekly view), knows somebody if there is a good tutorial? Or which layout would you use to design this? It should be possible to add events with a beginning and ending time... Thanks in advance Johannes ...

Java swing: how to know the state of the mouse from outside the component receiving the event ?

Hello, I want to know the state of my mouse buttons (pressed or not), from outside the target component. I don't want to use a glasspane to intercept events. The MouseInfo class can give me the location of the mouse, but not its state. Is there a way of retrieving mouse state from anywhere in the application ? Thanks. ...

Override paintComponent in Netbeans GUI

I've added a JPanel to my Netbeans generated GUI, and add a JPanel BoxThing that overrides paintComponent and draws a small red box, but it doesn't display, paintComponent never even gets invoked. If I instantiate my own JFrame and put a JPanel containing a BoxThing in it, it works fine. I've seen this question asked a few other times o...

Is it possible to Hide Text through a Style?

I currently have a JTextPane that will be displaying text coming in from different streams. The way that the user can tell which stream the text came from is that the text from each stream has a different Style to it. Is there a way to make a Style that will hide the text so that I can filter out different pieces of text? Thank you. ...

Components are not longer resizable after moving

Hi guys My question relates to swing programming. I want to enlarge a component (component x) by removing it from its parent panel (component a) and adding it in one of component a's parent (component b). Before that, I call setVisible(false) on all components in b. After that I want to make this back by removing it from b and adding on...

NullPointerException when showing JFileChooser

I show a JFileChooser with this snippet: public File getDestination() { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int option = chooser.showSaveDialog(null); if(option == JFileChooser.APPROVE_OPTION) { return chooser.getSelectedFile().getAbsolutePath();...

Task Manager Like App using Java Swing

I want to how know how to set about writing a monitoring app such as Windows task manager using Java Swing. The main feature I am concerned with is the grid with a graph which get drawn with time. What are the features that I need to accomplish this? (e.g.: Java2D etc). ...

how to sort JTable by providing column index externally.

I would like to implement sorting on JTable by providing column index externally in program. Here is my sample code in which i have initialize JTable, Add one Column and 30 rows to JTable. After rows has been added i am sorting JTable by providing column index 0 but i could not get sorted data. how can i get my first column in sorted ord...

JAVA - Strange problem (probably thread problem) with JTable & Model

I am using 2 Tables (JTable) with their DefaultTableModels. The first table is already populated. The second table is populated for each row of the first table (using an SQL Query). My purpose is to export every line of the first table with it's respective lines of the second in an Excel File. I am doing it with a for (for each line of ...

java swing : JTable strange behavior from getAccessibleChild() method resulting in null pointer in client code

Hello, I've encountered a strange behavior from JTable (JDK 1.5_22): After a selection change in the table and under some unknown particular circumstances, the JTable will call the cell renderer with 'null' for the value parameter. This will eventually lead to a nice 'Null Pointer Exception' on a custom renderer code that is not ready f...

ALWAYS on top window

Hey, I'm searching for a solution in order to keep a JFrame always on top and with always I really mean always. setAlwaysOnTop( true ); This won't work when I'm starting a game in fullscreen mode. I know you normally don't want your windows to stay on top but in this case it's required. ...

How to create a rounded title border in Java Swing

I do understand that to create a title border, you do something like: BorderFactory.createTitledBorder(" Your Title "); However this creates a rectangle border whereas I need a rectangle with curved corners. Now from what I understand you can create your own custom border by: class CustomBorder implements Border { ... } The p...

Swing: does DefaultBoundedRangeModel coalesce multiple events?

I have a JProgressBar displaying a BoundedRangeModel which is extremely fine grained and I was concerned that updating it too often would slow down my computer. So I wrote a quick test program (see below) which has a 10Hz timer but each timer tick makes 10,000 calls to microtick() which in turn increments the BoundedRangeModel. Yet it se...

Adding fields to a proxied class in Clojure

I'm using "proxy" to extend various Swing classes in a Clojure GUI application, generally with code that looks something like: (def ^JPanel mypanel (proxy [JPanel] [] (paintComponent [#^Graphics g] (.drawImage g background-image 0 0 nil)))) This works well but I can't figure out how to add additional fields to the newly e...

MouseListener fired without checking JCheckBox

This one is pretty crazy: I've got an AppSight recording (for those not familiar, it's a recording of what they did including keyboard/mouse input + network traffic, etc) of a customer reproducing a bug. Basically, we've got a series of items listed on the screen with JCheckBox-es down the left side. We've got a MouseListener set for ...

How to manage a BorderLayout with generic JPanel()

Im not sure how to reference to JPanel when it was declared like this. This is the coding of the entire program: Everything works but the layout is not how I want it. adding BorderLayouts to it doesnt seem to work. class FrameDemo { public static void main(String[] args) { final JFrame frame = new JFrame("CIT Test Progr...

Intercept jTable selection change events

I found this forum thread which suggests overriding ListSelectionModel to prevent rows from being selected. I would like to prevent selection changes when there are unsaved changes (external to the table) for the currently selected item UNTIL the user confirms the discard. Something like: public class confirmSelectionChange extends Def...

display jasper Viewer inside a jpanel/jframe..?

Hi everyone, i'm a newbie in using jasperreports. In my swing application i wanna show jasper viewer inside a jpanel or jframe..! can anyone help me out..? Thanks in advance...! ...