If you want to fill up the right corner gap between your JTable and JScrollPane ...
JButton jButton = new JButton(new ImageIcon());
jScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, jButton);
If you want the horizontal scrollbar in the scrollpane which contains JTable..
jScrollPane.setHorizontalScrollBarPolicy(
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
My name is Aravindhan.A and I am with Software AG. Having a passion towards programming...striving to become a vivid programmer... :)
Showing posts with label Swing. Show all posts
Showing posts with label Swing. Show all posts
Monday, May 12, 2008
Achieving KeyEvent in Editable ComboBox
ComboBoxEditor comboBoxEditor = jComboBox1.getEditor();
JComponent jComponent = (JComponent)comboBoxEditor.getEditorComponent();
if(jComponent instanceof JTextField){
jComponent.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
JOptionPane.showMessageDialog(null, "Iam from ComboBox");
}
});
}
JComponent jComponent = (JComponent)comboBoxEditor.getEditorComponent();
if(jComponent instanceof JTextField){
jComponent.addKeyListener(new KeyListener(){
public void keyTyped(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
JOptionPane.showMessageDialog(null, "Iam from ComboBox");
}
});
}
Bringing out a ComboBox selection in JOptionPane..
String[] test = {"Java", "Swing", "RCP"};
JOptionPane.showInputDialog(this, "Select Technology", "OptionPaneTitle", JOptionPane.INFORMATION_MESSAGE, icon, test, "Java");
This should bring you an input dialog and the return type would be the selected object...
JOptionPane.showInputDialog(this, "Select Technology", "OptionPaneTitle", JOptionPane.INFORMATION_MESSAGE, icon, test, "Java");
This should bring you an input dialog and the return type would be the selected object...
Adding Popup Menu in Netbeans to a Frame
In the frame mouse clicked event type in the code as
jPopupMenu1.show(this, evt.getX(), evt.getY());
Don't forget to add a menu item to the popup menu......:)
jPopupMenu1.show(this, evt.getX(), evt.getY());
Don't forget to add a menu item to the popup menu......:)
Types of Images in Swing
Toolkit Image, Buffered Image, Volatile Image is H/W accelerated image, Managed Image...
Thursday, April 10, 2008
Swing with a Zing
This was a title for the presentation on swing @ sun tech days...and also the title for my tech talk which i presented @ Unisys....My first presentation on Swings and it went fyn....had a couple of good questions....and positive feedbackz....
Subscribe to:
Posts (Atom)