swing

Alternative LAF to quaqua

Since installing the new version of quaqua I have been having weird problems like text not displaying over my intro splash screen and the default java icon showing up on dialogs instead of mine. I was wondering if anyone knew an alternative to quaqua I could try for Mac LAF. ...

Managing swing UI default font sizes without quaqua

We are trying to get quaqua out of our application but we had been using a call to quaqua to set the font size to be smaller with a call like this: System.setProperty("Quaqua.sizeStyle", "small"); My question is there an easy to do the same sort of thing without using quaqua? Or does anyone know another good look and feel for os x? ...

What's wrong with this code?

I wrote this code: public class FileViewer extends JPanel implements ActionListener { /** * */ private static final long serialVersionUID = 1L; JFileChooser chooser; FileNameExtensionFilter filter = null; JEditorPane pane = null; JTextField text = null; JButton button; JTextArea o = null; URL url; public FileViewer(JTextArea...

Changing a JLabel's Value from a JSlider's Value

I have a single JPanel that contains a JSlider and a JLabel. I want to configure it so that when the JSlider's value is being changed by the user, that new value is reflected by the JLabel. I understand that I can fire ChangeEvents with the Slider, but I don't know how to add a ChangeListener to the JLabel. Here's a snippet of my code. ...

Swing's BasicHTML.createHTMLView metrics usage

I'm doing some graphics processing and HTML is a perfect choice for styling the displayed content. I'm trying to reuse swing's built in html support, and it works perfectly if I hard code the height passed to View.paint, but I can't figure out how to determine how tall the bounds of the rendered content would be at runtime given a specif...

How do I make a JLabel that has an imageIcon that is available to all methods and classes?

I want to have an ImageIcon in a JLabel that i will be able to update from another method. But I can't figure out a way to be able to create a static JLabel(so as to be able to acccess it from another method) and also instaiate it as a Jlabel that contains an imageIcon - is there another method other than JLabel label = new JLabel(imgIco...

Need FileDialog with a file type filter in Java

I have a JDialog with a button/textfield for the user to select a file. Here's the code: FileDialog chooser = new FileDialog(this, "Save As", FileDialog.SAVE ); String startDir = saveAsField.getText().substring( 0, saveAsField.getText().lastIndexOf('\\') ); chooser.setDirectory(startDir); chooser.setVisible(true); String fileName = cho...

How can we set the exit button of JFileChooser???

we use setDefaultclose Operation(JFrame.EXIT_ON_CLOSE) for JFrame and those classes that implements JFrame. what can we do like this for JFileChooser????(the window that suddenly when you push browse button will pups up) ...

My GUI is frozen

Hi all, I have something I can't understand: my Swing GUI contains a 'play' and 'pause' button. I have also a static variable that defines 'ON' and 'OFF' states. (The main program generates the GUI). By cliking on 'play' I change the state of my static variable to 'ON' and I launch a time-consuming process in a thread that also modifies...

Drag and drop feedback in a JTree with custom TreeCellRenderer (Java, Swing)

I have a class derived from JTree with custom TreeCellRenderers. I have implemented drag and drop in that tree, so a user can rearrange tree nodes. The drop mode is DropMode.ON_OR_INSERT, so the user can drop nodes on or between other nodes. While the user is dragging the node, if the pointer points between nodes, a blue line is drawn i...

How do I prevent button surround from displaying in Java?

Hello, Sorry for the odd choice of words for the title, however, "border" seems to be the inappropriate term. While it is true that the visible line surrounding an icon in a JToggleButton can be made invisible by using setBorderPainted(false), the same is not true for JCheckBox and JRadioButton. I can not use the JToggleButton and the...

Swing JTable Layout: how to make table occupy complete viewport - like in eclipse IDE

In the application I am building, I will be making a few tables display different data. And I want my table to look like the tables in Eclipse IDE, like in the Problems View or the Tasks View (ignore the tree structure of the Problems View) What I am mainly interested in is the last column in the above views indicated in the picture bel...

How do I determine which monitor a Swing mouse event occurs in?

I have a Java MouseListener on a component to detect mouse presses. How can I tell which monitor the mouse press occurred in? @Override public void mousePressed(MouseEvent e) { // I want to make something happen on the monitor the user clicked in } The effect I'm trying to achieve is: when the user presses the mouse button in my app...

How to layout a components in vertical only scrollpane ?

Hi all, I have a complex question I cant find an answer anywhere. here is a example : public static void main(final String[] args) { final JFrame frame = new JFrame("test"); final JPanel bigPane = new JPanel(new GridLayout(0, 1)); frame.setContentPane(new JScrollPane(bigPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDE...

How to disable the default painting behaviour of wheel scroll event on JScroolPane

I recently purchased the book Filthy Rich Clients and i found it really useful and fun. Building on one example from the book i tried implementing a custom ScrollPane that displays a "shadow" on the bottom of its view over the component to be displayed. I ended up with the code below. It works but not perfectly. Specifically when i scrol...

Loading JList with components/values

Can anyone tell me how I can insert some components/ values into JList? I 've being trying all means of loading my JList which can later-on be drag unto a textpane. Can anyone help me please? ...

Swing Menu that can be customized by user

Is there any framework or lib out there to create a Java swing menue that can be edited by the user via drag and drop? Added: Implementing a polished solution myself can take a lot of time. What i would like to see: display the entry while dragging, opening submenus automaticially, showing a line where the item would be placed when rele...

How can I know when the text of an editable JComboBox has been changed?

I have an editable JComboBox where I want to take some action whenever the text is changed, either by typing or selection. In this case, the text is a pattern and I want to verify that the pattern is valid and show the matches that result in some test data. Having done the obvious, attach an ActionHandler, I have found that, for typing...

switching between console mode and graphical mode

Hello. I just wanted to know if there is some way to switch between console mode and graphical mode. I am using java on swing. I'd like to know if I can type something in the shell to go to a console mode, then type something to go back to the desktop. Or if I can press some key at boot time, or something. The idea is to make my server...

Create a "Command" Console

Hi, I have a bit of an unusual question: How can I create a "Command Console" using Swing? What I want to have is a console where the users type in commands, press enter, and the output from the command is displayed under. I don't want to allow the user to change the "prompt" and older output. I am thinking of something like Windows CM...