swing

Scrollable flow panel

I need to create a panel where I can put some rectangles and it automatically reorder just inserting a scrollbar and growing up vertically. Also this panel can be resizable and again the rectangles must to be reordered to correctly be displayed inside the panel. ...

Scrollbar visible

Is there some way to know if a scrollbar is visible or not inside a JPanel? I mean, some times, my panel has many rectangles (think it as buttons) and needs a scrollbar and some times it doesn't need it. I'd like to know if I can know when it is being shown. ...

Getting system font properties in Java/Swing

I am working on a Java application using Swing and I want to set up the GUI using the "proper" fonts and font sizes. With proper I mean the fonts (+size) as defined by the user, so that my application will fit right in to the user's screen setup (resolution / font size combination) without having to provide my own custom settings. My app...

How to combine repaints in Swing?

I am calling repaint a bunch of times from a listeners, but the way I designed my paint function is only one repaint is required. I generate a bunch of repaints, since it hooked into my mouse motion listener. Is there a way to cancel all pending repaints for a certain component? I can't just start ignoring repaints, since some are val...

Doc templates to PDF files in java (looking for tools/libs)

Hi all, I tried to read the related questions and didn't find any new tool. Here is my problem : i generate some PDF files for an insurance from the data in my app. Stuff like, contracts, certificates, bills etc. The insurance guy gives me the templates files as .docs with fields in them and I have to fill in the fields with my data a...

Making a JOptionPane with 4 options

I need to make a custom dialog with 4 options but as far as I can tell you can only have one with three options. Here is how I would make an option pane with 3 options: Frame refFrame = DialogUtils.getReferenceFrame(); ///TODO: /// - Use DialogUtils int option = JOptionPane.showOptionDialog(refFrame, ...

ContentPane and JProgressBar not visible

I have created a JDialog extension that has one component, a JProgressBar, inside the content pane. The JProgressBar is public because I want the value to be set by the owner class. When I create a new Dialog, the content pane doesn't appear at all, resulting in whatever is behind it being displayed instead of the progress bar: Since I'...

Change color of WindowsPlacesBar in JFileChooser

This is a followup question to my previous one: http://stackoverflow.com/questions/1241984/need-filedialog-with-a-file-type-filter-in-java I've got a JFileChooser (using that instead of a FileDialog so I can have a file type filter) and I've managed to style it pretty decently for our darker color scheme option except for that little p...

how can i use JXMapViewer in my applet?

hi i want to write an applet that must render my map images with zoom/pan tools, i find out JXMapViewer can help me, how i can use it? where i can find related docs which help me to write an applet that request on my image server to provide tiles to render? what about image server and .... !!!!??? help me on : image server structure, ti...

java swing graphics color blending

Hi, I have a bunch of shapes that I'm rendering with different graphics objects. I'd like it so when the shapes overlap, they use some alpha blending to combine the colors. However, I only want them to blend with the other shapes, not with anything else rendered. Is this possible? thanks, Jeff ...

Is there a FREE Java GUI designer?

Is there a FREE (or relatively cheaper) Java GUI designer/builder? ...

Tristate Checkboxes in Java

I could really use a tri-stated checkbox in Java. It sounds like a simple thing, but I've only seen really ugly implementations. Three radio buttons just take up too much real estate and will probably be confusing for the users in my case. It's basically for a search dialog. I need true, false or "don't care" options. Is there a dif...

Creating a JFrame from another JFrames constructor

I have 3 objects that extend JFrame let's call them FrameA FrameB FrameC. FrameA is my main application window. From FrameA's constructor if the application is not registered i create FrameB and FrameC. They are just popup's that indicate trial period. 2 times out of 10 application freezes and never shows the B anc C frame and frame A ...

How can I get the functionality of `<input type="file" of HTML in Swing?

How can I get the functionality of <input type="file"> of HTML in Java Swing? ...

Using SwingWorker publish efficiently

I am using SwingWorker to query a server process for a large number of "result" objects on a background thread. As individual results arrive I want to publish them and display them on the GUI. My question is: Given that I will be receiving potentially thousands of results is it more efficient to call publish(V... chunks) for every N re...

Centering dialog using JOptionPane.showMessageDialog

I’ve always been using code similar to the following to display dialogs: JOptionPane.showMessageDialog(JOptionPane.getFrameForComponent(this), … yada However, I’m now thinking that this is "more correct": JOptionPane.showMessageDialog(getRootPane(), … yada What do people prefer / recommend? ...

importing Source code into Jlist

Hello, Is it possible to importing a java source code into Jlst? Please tell me how, and ll appreciate an example if possible. Thanks ...

Internationalize Swing Applet Menu Items in English and Chinese - Examples?

A Java Swing applet needs to display its MenuItems in Chinese or English, depending on how a user has set their system preferences. Has anybody seen compilable examples showing how to do this? I've seen a few articles on the subject of i18n and Java/Swing (for example, this one), but so far I haven't found anything specific to the subj...

Bug in JOptionPane.showConfirmDialog?

I want to prompt the user for a confirmation when they want to close the frame window, like so: addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { if (JOptionPane.showConfirmDialog(null, "Are you sure you want to abort the game?", "Really quit?", JOptionPane.YES_NO_OPTION) == JOption...

Making a JTable cell editable - but *not* by double clicking.

I am trying to add a column to a JTable with the following behaviour (similar to Windows Explorer and similar shells): The cell can be clicked once to select it, as usual. The cell can be double-clicked to perform a separate action (launching an external program.) The cell value (a string) can still be edited, by single-clicking a seco...