swing

How do I manually invoke an Action in swing?

For the life of me I cannot seem to find details on Java Swing Actions :'( When I came across them I immediately realised their usefulness. So far it's all been easy to work with. Now I'm stuck with one little thing: How do I run them manually? I mean by code? Note that I am building the GUI using Netbeans (if that makes any difference)....

I want to develop billing and inventory software in java

Hi all i want to develop a desktop based billing and inventory software for my Retail FMCG store.I know how to program in java so will develop in same.are there any tutorials,book,guide,sample projects on Billing and inventory software in java. Can u tell me how to proceed about it.i know how to do database designing.also which is best ...

How to remove gap between controls in JToolBar?

How to remove gap between controls in JToolBar? I want to have no free space between controls in JToolBar. EDIT: I was wrong. There is no free space. The problem is caused by JButton (situated in JToolBar) with icon only. It has some extra margins around the icon. How to remove them? ...

How to set jTextArea to have height that matches the size of a text it contains (to avoid scrollbars)

This problem looks trivial, but I can't find the solution. When I create a form it contains a JTextArea. I want to put large constant text in it. If the text is say 1000 lines long, I want my JTextArea to be 1000 lines high (to be large enough to display the entire text without scrollbars). JTextArea is inside a panel which can have sc...

Limits to Swing's Unicode support

Not long ago I asked a question attempting to identify a certain unicode character for use in a GUI. I got the character I was looking for, but it didn't work in the Swing GUI I was building. So, SO Community, I pose of you these questions: What sort of limitations does Swing/Java have for Unicode support? Are there certain subsets o...

How to set the textfield is not visible in frame

I am using Swing framework, and I have one question. The Address panel is dynamically added to the main frame. I want to call the visible(false) method from the main frame on the Address Panel. ...

How can this SwingWorker code be made testable

Consider this code: public void actionPerformed(ActionEvent e) { setEnabled(false); new SwingWorker<File, Void>() { private String location = url.getText(); @Override protected File doInBackground() throws Exception { File file = new File("out.txt"); Writer writer = null; ...

Center Swing Windows

I'm using Netbeans to develop a Java Swing application. How can I make it so that when the program itself and any other windows open they come up in the center of the screen? I've been struggling with this and with setting the default button the "enter" key is tied to. Thanks! ...

java jtree redisplay tooltip for every item after a delay

When a tool tip is displayed on a tree and the mouse is moved the tooltip stays visible and the text changes. Is it possible to hide the tool tip and redisplay it when the mouse moves from one item to the next. ...

Java Swing - Can i run 2 GUI actions in the EDT ?

In a JDialog, when user clicks a JButton i want to execute 2 GUI actions in the EDT : Showing another small JDialog with a busy icon in it to tell the user "Please wait while the wrong process ends". Inserting a big number of records in a JTable. When i try to execute both actions the "please wait" dialog blocks the inserting process...

how to choose a jre on runtime ?

i have a Swing app and i want to run it with Nimbus look'n'feel. I have the last update for the JRE and I know how to setup my app to use Nimbus look'n'feel using UIManager class, but I want my app to choose the right JRE on runtime to use Nimbus. How to do that? I am using Netbeans. ...

How would you chromatically run external JFrames?

I want to make an if statement, BUT I need to return the value of setVisible so I can make a statment like: if(visible = false) { haha theres no code in here <_< } I have no idea to return the value of setVisible. EDIT: All of my JFrames are seperate programs called by the Main program, I want all of the frames to run individual...

unit test for Java Swing application

Hi, I'm looking to Unit Test a Swing application and was wondeing what would eb the best(easiest) approach to achieve this objective with almost full line coverage. If it matters, I'm using Eclipse Galileo for developemnt. Thanks. ...

How to add a WindowListener to an external event.

This is my code I have developed. This is the main program which holds and executes each external JFrame for my Game. chooseGender is an external program which is nothing but a JFrame and its components. My goal for this is when chooseGender executes, it has 2 buttons for options (male, female) when the user picks one, an actionListene...

Java Swing + Threads

Hello! This code draws two lines but waits a second.. I am looking how to do that in a seperate thread so it wont freeze the application.. To draw one line and display it to the user and then the second.. Sorry but i am confused.. found too many solutions public class Askisi2_3 extends JFrame { private class LineJPanel extend...

Show "no rows found" inside a JTable row if not found entry while filtering

i have a JTable with row filter. once fitered if i didn't get any row then i have to show a string like "Nothing found to display " inside table as first row. please do needful. Thanks , Narasimha ...

Letting User add Nodes to a JTree, nodes do not appear if parent has EVER been expanded

I have a problem with inserting nodes in a JTree. Basically the user right clicks on a parent node, bringing up a list of the possible children to insert. They select one it is inserted as a child of the selected node. This all works great when the parent node has never been expanded. However, if the parent node of the node the user ...

JPanel does not generate MouseEvents when cursor is on child components

It is a bit strange for me but JPanel does not generate MouseEvents when cursor is on child components: JTextField and JToolBar but it generates MouseEvents when cursor is on JLabel. Could someone explaind me why? Is there any way to force JPanel to generate events even if mouse is on child components? ...

jeditorpane caret location and string location not in sync

I'm trying to fix a bug in this code that was made for windows but dosent work in linux( I didn't write the code), the location of the caret and the typing location is not in sync. the dot and Mark location are the same and the setMagicCaretPosition dosent work the way I think, any help?(what properties should I monitor) this program ha...

netbeans: linking the app and view ?

when you create a gui application in netbeans IDE, it generates 2 files, the App.java and View.java is it okay to include the application logic in view.java ? my intuition tells me this is a bad idea. However, I don't know how I can call the methods or somehow "hook" the App.java with View.java So instead of having to put all my code ...