swing

Comparison of GUI developing tools for linux

Hi All, I am fairly new in the domain of GUI designing and development. I do have some prior experience but that is with Visual Basic. I would like to develop a reasonably comprehensive (though not state-of-the-art) GUI application on linux based on a command line app. that I have. Having done some googling, I do find that there a...

can't detect that windows classic theme active

I am calling UIManager.getSystemLookAndFeelClassName(). And get as result WindowsLookAndFeel, even when setting current theme to WindowsClassicLookAndFeel. But I expect WindowsClassicLookAndFeel. Question is how can I detect that windows classic theme is now active ...

corejava Project help needed

Hi I'm Riya a B.Tech. student and i have to make a corejava project on the topic COLLEGE MANAGEMENT SYSTEM . I have created the required database using MS Access. I m facing problem in a code which i m attaching here. Actually i want to update a data in the data base so i have made 2 frames in one of them Roll no. is asked when it is e...

JTabbedPane indent

When using a JTabbedPane, how do you indent the tabs? Swing default output: ------- --------- ------ | A | | B | | C | ------------------------------ | | | | | | | | | | Desired indented o...

How do you turn on and off a monitor from within a Java application?

How do you turn on and off a monitor from within a Java application? In case you're wondering why, this is a kiosk style application where it would be great to turn off the monitors at night. Yes you can do it within the screensaver settings of the machine, but it would be great to do it programatically and avoid having to configure it ...

How do I set the position of a dialog so it is centered in it's parent frame?

I have a dialog class with a constructor like the following public SampleDialog(JComponent parent, String title){ super((Frame)SwingUtilities.getAncestorOfClass(Frame.class, parent), title, false); setLocationRelativeTo(parent); init(); } However, this positions the dialog so that it's upper right hand corner is in the c...

JFrame resizable height ONLY

Hello, JFrame.setResizable(true) lets the user resize both the width and height of a window. Does a method exist which allows the user to ONLY resize the height? Thanks. Edit: The solutions below do NOT seem to work. On a 360x600 JFrame, setResizable(true); pack(); setMaximizedBounds(new java.awt.Rectangle(0, 0, 360, 1200)); setMaxi...

problem subclassing JTextField: initial text value is not displayed

I need a JTextField that only accepts positive integers as input. My implementation mostly works. As you type text into the field, the digits appear and non-digits do not appear. But there is a problem with the constructor's "text" argument. If I pass a String that contains the String representation of a positive integer, I would exp...

JButton will work but won't display my icon when it is clicked on.

I have a buttonlistener that removes the TextFields and the StartButton when it is clicked, but the last part of the code that tells it to run a method that is supposed to display the icon is screwing up only at the end, but is still deleting the TextFields and the JButton. Please help. public class TypeInNames extends JApplet{ JButt...

capturing input from JTextInput when user doesn't press Enter

In my Swing app, I have a screen that has a bunch of JTextFields. Each JTextField uses an ActionListener's actionPerformed method to copy the user-entered text to my data model object. This method seems to only be called if the user presses Enter. How can I copy the user-entered text to my data model object if the user doesn't press E...

Swing make a JButton not focussable

I want to make a Java swing button 'not-focussable'. The button should not receive focus at all, but should be able to receive mouse clicks. I thought the following options, but these either dont solve my problem completely, or dont seem elegant. Are there any other/better/suggested options? Move the focus to the next component immed...

If use databinding in a dialog, how to restore data when user cancelled the editing?

If I get a bean and a dialog, and they are coupled with bidirectional data-binding, what is the best way to roll back to the original bean when user canceled the editing. EDIT 1 If user opened up the dialog in edit mode, he then did some modification and pressed "OK", then this dialog closed and the underlying bean got updated. When I...

pros and cons of data-binding for GUI form design

I know that data-binding sometimes can save lots of effort, but I'm not very clear on how to make decision that to use or not to use data-binding in various contexts. ...

how to grab user edition from numerous swing components?

I have a JFrame with a bunch of different JTextField and so on. How to collect data entered by user, without setting actions for each of this components? Note: I create this JTextField using "inline" code, like this: layout.row().grid(new JLabel("Density")).add(new JTextField("1")) .spanRow(); layout.row().grid(new ...

ISSUE java.lang.IllegalStateException: zip file closed

I have created a jar file which throws the below error, Its a simple swing app which inserts a row whn i press a button, not sure where I am going wrong please advise. private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: setatmid(jTextField2.getText()); setaa10(Integer...

Swing/JTable Not Updating After Bound Data Fires Change

I have a JTable which is bound to my EventTracker bean, essentially a wrapper around a list which I will use as append/clear only (i.e., a simple log). Problem is, when I add entries to the list and try to fire an event I don't see any changes. I'm using the NetBeans IDE. The EventTracker bean is added to the view and instantiated as ev...

How can I add localization to JFileChooser for a locale that is not supported by default?

The list of supported locales for "User Interface Translation" does not have all the languages I need to support. How can I add more languages for a JFileChooser? ...

How should a database-centric Java Swing application be designed?

I have been writing a database-centric Java Swing application for a while. The GUI and DAO-code ends up in a big tree like: JFrame | JTabbedPane | +--------------------+----------------------+-------------+ | | | | JPanel1 JPanel2 JPanel3 ...

Java drawing on JPanel which on a JFrame

Hi I have a JFrame and there are two JPanels on top of it. My intention is to draw on the JPanels. Can anyone please share any Java code? ...

Implementing Java2SAutoTextField to a JtextField

1) I was able to add a JTextField to the JFrame, and I initialized the class Java2sAutoTextField as given in Auto Complete JTextField (Swing / AWT / SWT / JFace forum at JavaRanch). 2) I initialized the list and field inside the JFrame constructor, as shown below. List possible = new ArrayList(); possible.add("Austria"); possible.add...