swing

Getting the unsaved dot on a Swing Mac OSX app with quaqua LAF

I am trying to make it so my app shows the unsaved dot in my swing windows when running on Mac with quaqua LAF. When I say unsaved dot, I mean in mac apps when you modify something, the red dot in the upper left changes from an empty red circle, to a circle that is mostly filled in with a darker red. Is there some flag I can set to ma...

Component based composition

Hello, Can anyone assist me to implement a component-based project? I have designed two components i.e calculator and engine (source codes below) which need to be inside any of the swing components (either JList , JTree, or any). Then there should be an ability of dragging any of the two components (calculator or engine) unto the editor ...

Initiating a commandline tool from GUI

I want to fire a commandline exe with the parameters entered in GUI. The Process class can be used to fork my required commandline process from the java application. And I used the getInputStream() method of Process object to get the result and got it displayed in the GUI. private void confirmActionPerformed(java.awt.event.ActionEvent ...

Sync JMenu ButtonGroups with JToolbar ButtonGroups

Hi, Imagine I'm making a simple Word Processor with Java Swing. I've got a set of Actions written to perform text justification. On the MenuBar I've got a menu: View Left Justify Center Jusitfy Right Justify This consists of JRadioButtonMenuItems and a ButtonGroup to ensure only one item is selected at any one time. Also, ima...

Painting over JMF component

I'm capturing the Stream from a webcam and would like to draw something on top of the video image. I try that in the example below, the problem is that the other component is always in the background no matter how I arrange the components. Is there a way do solve this? public class SwingCapture extends JPanel { private static final...

Java JFileChooser opens back up after clicking open in the chooser dialog

When I use the JFileChooser in my project that i am working on everything works just like it is supposed to work with no problems at all except for one. when you click "open" in the dialog it changes my background and then the JFileChooser dialog opens up again. could anyone tell me what i need to do to make that not happen?? here's al...

Is there a good DI framework suitable for Java 1.4 and SE (Swing) apps?

I am looking for a dependency injection framework for a Java SE (Swing) application that runs under JDK 1.4. Are there any recommended DI frameworks that I can use? (Guice and other annotation-based frameworks are out, and I don't want to mess with something like Retroweaver.) Also, is Spring suitable for use in a Java SE application? ...

action listeners and event sources in Swing

OK, so if I add an ActionListener to a GUI element, and it's the only element I use that ActionListener with, does it matter which of the following lines (a,b) I use to get the checkbox selected state? final JCheckBox checkbox = (JCheckBox)this.buildResult.get("cbDebugTick"); checkbox.addActionListener(new ActionListener() { @Override ...

a JPanel problem

Hello all, i am writing up a project just as part of my experiments... (for everyone that has already help with my other questions, thank you for very much.) Alright i have one file that already works.. both of my source files compiled correctly i have two jpanel's that are overridden so i can change their paintcomponents. One i use as ...

Java Swing : changing JTree selection while editingstopCellEditing() : how to get stopCellEditing() called before TreeListeners:valueChanged?

Hi, regarding to earlier question How to stop editing with DefaultCellEditor when a separate JBtton is pressed and Sun Bug 4724980: JTable: Add API to control what happens to edits when table loses focus.: With jtable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); i get my CellEditor to stop editing when table loses ...

Plot Graphs in Java

The java Swing GUI im developing needs to plot a 2D graph based on the x and y coordinates generated in the program. Is there a Swing component for that? Or is there any other open source package for the purpose? Thanks in Advance.. ...

How to push GridbagLayout not to lay components in the center of JPanel

the problem is in centered layout of components, GridBagLayout always 'sits' in center of JPanel, so I don't care how it will layout components inside, my problem is where these components will start laying out on a panel. I tried with: panel.setAlignmentX( JPanel.LEFT_ALIGNMENT ); but it did not helped. Any idea? ...

Animated *.gif framerate is too high

Hello! I'm loading an animated gif into a JButton. Online the gif looks to move at a normal pace. But when I load it in java it looks like the animation is trying to run as quickly as possible! How can I atleast slow it down? Here is my code: public Icon getIcon(){ return new ImageIcon(getClass().getResource("images/working.gif"), ...

inserting folder containing components into JList

Can anyone guide me or give an example of how to insert components, or files of components, or their folder into JList. This has being an issue pending, please assist. ...

Trying to bring swing frame to front before taking a screenshot but getting artifacts

I have a part of my app that takes a screenshot of a certain window but before I do so I want to bring the window to the front. This works fine on my Mac machine but when I tested it on in Windows XP on paralells the screenshot always has a greyed out area where the overlapping window was. It seems the screenshot is always taken while ...

JRadioButton border/padding/insets/margin... whatever you call it

In my Java app I am trying to create a very simple form with a label and a set of controls on each row of the form. Imagine something like this crude ASCII diagram: Result 1: (*) pass ( ) fail Result 2: ( ) pass (*) fail Error Count: [10______] Explanation: [Operator overload___] Annoyingly the JRadioButtons don't line up wit...

How to find out the instance when component resize is complete

In my application I fetch data if component is resized. I want to delay the fetch till user completes resize operation. ComponentListner event componentResized fires every time the window is resized. ...

Adding a child component to a JButton

Is it possible to place a child component inside a JButton and make it transparent to a subset of mouse events so that: The child component receives MouseMotionEvents (so it can respond by modifying a displayed image) Clicking still depresses the JButton "behind" the child component If you add the child component to the button but ma...

Detecting drops from the same process

Hi there, Is it possible for a class implementing DropTargetListener, to detect whether the stuff being dragged comes from the same process of from elsewere? ...

Java Swing: JList with ListCellRenderer selected item different height

Hi all, I'm making a custom ListCellRenderer. I know that you can have different dimensions for each individual cell. But now I want to have a different dimension for the selected cell. Somehow, the JList is caching the dimension for each individual cell the first time it has to calculate bounds for each cell. This is my code: public c...