swing

Java - Problem with filtering on a JTable

Well guys, here i am. In three days i couldn't resolve this problem. (I'm italian, sorry for my english). Shortly. I have a panel on which there is a JTable that show a mp3 list. Then another panel whith a JComboBox (with it i can choose the type of filter), a JTextField (where i write what i want to search/filter), and a JButton that ...

Get correct editing behaviour in JTable using java DefaultCellEditor

You can go into a cell in a Jtable either by clicking on it, or by going into it using cursor keys/tabs. With defaultCellEditor and a JtextField if you go in using cursor keys the caret is put at the end of the existing text field, whereas if you double click the field it will highlight the last word. Whereas spreadsheets seem to work ...

Disable Background drawing in JFrame in order to properly display Aero (DWM) effects.

I'm having problems using the DWM functionality of Windows Vista/7 on Java windows. I want to make the background of my frame use the Aero style. The Windows API to do so is provide by the function DwmExtendFrameIntoClientArea in the dwmapi library. I've managed to call the procedure properly via JNA, and it does what it is supposed to d...

Portable way to have horizontal scroll bar for JComboBox

From Coderanch and Sun Forum, I know the technique to have a horizontal scroll bar for JComboBox. However, their suggested solution are bounded to Look n Feel specific. As you can see, the below key code snippet will not work well, if users are under Linux machine with GTK+ look n feel, or Windows machine with Nimbus look n feel. How ...

Text is not fully shown in JTextField

They say a single image is worth 1000 words: I'll just note that the size is set to default. (build in NetBeans) any idea how do I fix this? Adam. ...

java.awt , swing, and APACHE POI for Power Point Presentation

I'm trying to use SlideShow to create presentation... http://poi.apache.org/apidocs/org/apache/poi/hslf/usermodel/SlideShow.html and I see some uses of java.awt classes in the examples. My question is: to what extent awt can be used in creating PPT using POI? further, how swing can be used together with Apache POI? Could some exper...

How do i update swing application view from one screen to another?

I am a beginner in java swing. I have just created my first login screen using netbean. I like to ask after my actionPerformed if say login successfully. How do i actually go to the next screen? As in coding wise how should i code or netbeans got something build in for this ...

Swing Spy, a Swing/AWT spy agent unable to find swing widget under cursor of swing app integrated in sharepoint

Swing application is integrated into Sharepoint. Swing spy unable to find the swing widget. ...

Problem getting focus when use JPanel as JTable cell editor

I have a cell editor that contains a little button that can be double clicked on to bring up an edit dialog, and then a textfield that can be used to edit the value inline (the popup is required to allow editing of additional values, only the first is shown in the JTable). When user clicks on field everything is okay, but if they tab in...

Why does Java Swing html font rendering look so crappy ?

To display a complex multi-line label with multiple styling I use Swing's html rendering capabilities and end up with really crappy font rendering. I have tried to explicitly set the font family - infoLabel.setText("<html><span style='font-family:Tahoma;'>My text.. But compared to non-HTML text, the JLabel with HTML text always rende...

Prevent Enter Event from Bubbling to to Main Window

I have a custom Swing component called NavigationLink which extends JLabel and implements a key event listener like so: addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { boolean actionInvoked = e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_SPACE; if (actionInvoked && Navig...

How can I remove the gap when using a JButton as a ComboBoxEditor in the Windows L&F?

I'm trying to use a JButton as an editor within a JComboBox. On Mac OS X this looks fine, but on Windows using the system look and feel, there is an ugly gap left between the JButton editor and the combo button itself: This is the test code used to produce the dialog: import java.awt.*; import java.awt.event.*; import javax.swing.*;...

Improving Swing layout

I have a following code : import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.Label; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax....

JComboBox - no ItemEvents for null-items

It seems no selected or deselected ItemEvents are generated for the null-item in the JComboBox. How can I change this? Making the item "" is not an option. import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JComboBox; import javax.swing.JOptionPane; public class ComboBoxTest { public static void ...

Losing first character in JTable panel based cell editor

I have a cell editor that contains a little button and then a textfield that can be used to edit the value inline I use setSurrendersFocusOnKeystroke(true) and a focus listener in order to allow a user to start editing immediately from the keyboard, but the trouble is the fisrt key pressed seems to get consumed rather being added to th...

How to disable JSplitPane arrow button

Hi, How do I disable(grey-out) the arrow button on the JSplitPane. I do know how to get the button from BasicSplitPaneDivider like this: final int UP_ARROW = 0; final BasicSplitPaneUI ui = (BasicSplitPaneUI) splitPane.getUI(); final BasicSplitPaneDivider divider = ui.getDivider(); final JButton upArrowButton = (JButton) divider.getComp...

Using JSplitPane with an AWT component

I have an AWT canvas which I cannot convert to a Swing component (it comes from VTK). I wish to display a few of these canvases inside of a JSplitPane. I've read about mixing heavy and light weight components in Java and know that it's a pain in the butt, but I don't have a choice. If I wrap the AWT canvas inside of a JPanel and then ...

Adding text and image in JList in netbeans.

I have created a GUI in JApplet Form in netbeans which also contains a JList. i just want to know how to add a text and an image before text. i know how to add a text by creating an array and pass it to the constructor of the JList but that was in simple JPanel but in JApplet Form code is disabled (non-editable).I am stuck into it.In Sho...

Scala Swing component sizing

Scala is an awesome language, but unfortunately the library documentation is lacking. How do I change the initial size of a component? I have nothing on it (intentionally), but would like it to be a certain size anyway. I currently have ... contents = new BoxPanel(Orientation.Vertical) { contents += new BoxPanel(Orientation.Horizont...

Pressing save button in JFileChooser opens a folder instead of saving a file

I'm having the following problem with a JFileChooser: I create a save dialog and then when I'm trying to save a file, I'm entering a file name into the field and click "Save". Suppose that the directory, which I try to save my file to, contains a subdirectory, which is named exactly like the entered name. In this case JFileChooser opens ...