swing

java+swing+mvc: how to make a model that interfaces w/ multiple controls?

I have this Swing app I'm working on that has a pair of JSliders and JTextFields that both display & control the value of two numbers. Right now I kind of hacked things together to make it work, intercepting change events and updating the display. However I'm thinking a better way would be to make a model that has the two numbers and som...

jgoodies binding: using a JTextField with a formatted number?

I am trying to bind a JTextField to a bean's field that is a double using JGoodies Binding: JTextField myJTextField = ... BeanAdapter adapter = ... Bindings.bind(myJTextField, ConverterFactory.createStringConverter(adapter.getValueModel("amplitude"), new DecimalFormat("0.00000"))); This works, at least in the bean ...

Drawing graphics in java (netbeans ide)

I created a new JApplet form in netbeans: public class UI extends javax.swing.JApplet { //generated code... } And a jpanel in design mode named panou: // Variables declaration - do not modify private javax.swing.JPanel panou; How do I get to draw a line on "panou"? I've been searching for this for 5 hours n...

Java dynamic JTree

I want to find the method that adds nodes to a JTree dynamically, looking through the documentation and the examples, this can only be done at the constructor of the JTree. If possible please show me the code snippets to do this. Thanks in advance. ...

swing: JSlider but with coarse/fine controls?

I have a JSlider with 65536 different values. It works great for coarse adjustments and for very fine adjustments (+/-1 using up/down arrow) but is very poor in the middle. Is there anything out there that would be better? I can vaguely imagine taking 2 sliders one for coarse + fine adjustments, but can't really figure out how to get th...

When a superclass extends JFrame

Hi, I am trying to use a class which extends JFrame to build a GUI. ex : class Deck extends JFrame The GUI is built in its constructor. Now when I extend Deck from another class, ex : class Pile extends Deck New windows are being created whenever an instance of the subclass (Pile) is started. Is this happening because the subclass...

java gui without desktop environment

Is it possible to use java gui frameworks (such as Swing, SWT or javaFX) without desktop environment, such as Gnome? ...

Websocket and Java Swing front end

Is it doable to make Websocket interfaced with Java Swing front end? If so how? ...

Java JTable object with multiple fields

I have an object that has X number of fields. Each row in my JTable corresponds to one item. Each column in the row represents a field for that item. I also need to maintain a reference to the item (the item has a unique ID field as well) so I can determine the item in the selected cell. Would the preferred approach to this be putting t...

How to hide cursor

Is there anyway to hide cursor other than using transparent gif image? ...

close window event in java

I added an window state listener as follow: this.addWindowStateListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { ExitAction.getInstance().actionPerformed(null); } }); But when I'm using the X close button the event is not called. I think it's something to do with netbean jdeskto...

Deleting and replacing selected text in JEditorPane

I am trying to make a Text Editor using Java Swing. In that I am using JEditorPane instead of JTextArea. I am facing problems in deleting selected text and replacing selected text from the JEditorPane. The Code I am Using is: public void delete(JEditorPane txt) { int start = txt.getSelectionStart(); int end = txt.getSelectionEn...

How to wait for object creation in EDT without blocking EDT?

I am using an API in a Java library which is called from the event dispatch thread and requires me to return a fully-initialized UI component. It looks like this: public JDialog createDialog(); But I can only populate the dialog after loading from a database, which can take 10 seconds sometimes. Normally I would do that in a backgrou...

Can I batch some Swing component updates so that repaints are all done at once?

I have a bunch of buttons in my JToolBar, and I set some of them to be disabled or enabled depending on the state of my application. I find when I am updating a number of buttons at once that they are not all repainted at the same time. I want to ensure that when I set a number of buttons to be disabled/enabled, that they all change st...

How to display flowcharts dynamically in java?

I want to develop a java desktop application that takes some inputs from the user and store it in a database. After that, when user clicks on a button (say display) it displays the information, entered by him earlier, in a flowchart like format. Can I display that information in the form of flowcharts? ...

How to implement JSplitPane in the BorderLayout?

HI, how can i use the JSplitPane so that they show up in the borders of a BorderLayout??? So that i can resize each sise (NORTH, EAST, WEST, SOUTH, CENTER). Thanks ...

Is there a nice way to abstract the GUI so SWT or Swing can be used?

I'm writing an application that has an SWT GUI currently, but would like the end-users to be able to choose between SWT and Swing. I've experimented with abstracting the GUI details before at different layers in the program, but have never been really satisfied with the results. Is there an agreed-upon or nice way to do this? ...

JToolbar background image

I'm using a customized JToolbar using the following code: public class GeneralToolbar extends JToolBar{ public GeneralToolbar() { super(); setBackground(Color.white); setOpaque(true); setPreferredSize(new Dimension(54,54)); setMinimumSize(new Dimension(54,54)); setMaximumSize(new Dimension(54,54)); setSize...

How to make a JTable non-editable

How to make a JTable non-editable? I don't want my users to be able to edit the values in cells by double-clicking them. Any help would be greatly appreciated. Thanks. ...

Difference between Java.exe and Javaw.exe

recently I noted that some applications are running on javaw(not in java). What is the difference between them and how can run my swing application on javaw? ...