Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

JTable-Row color issue

701922Jun 30 2008 — edited Jul 4 2008
Hi !

I have JTable... with its 5columns,
5th column is off Boolean Type.(check boxes)
What I require.. is when user checks the JCheckbox.. I want that entire row to change its color and when un-checked reture back to its orginal color.

I use DefaultTableModel.

Pls post a simple samplecode..Thanks in advance.

Pls help !!

Edited by: dashok.83 on Jun 30, 2008 2:15 AM

Comments

794342
add the indicated line and it should work
(but you may get other problems, look you don't want, color etc)
public static void main(String[] args){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      JDialog.setDefaultLookAndFeelDecorated(true);//<-----------
      new FileChooserSizeTest();
}});
}
843805
Michael_Dunn
yes it works! if I add JDialog.setDefaultLookAndFeelDecorated(true);

but that's the only way you know?
because yes it give me looks and feel problems my project :(
794342
the only other way I've seen is to add a componenLlistener,
and in componentResized() check the dimension - if under the min, reset to min
but I've not seen anyone happy with this solution - the component can be
dragged to small size, then 'snaps back' to the minimum
843805
the only other way I've seen is to add a
componenLlistener,
and in componentResized() check the dimension - if
under the min, reset to min
but I've not seen anyone happy with this solution -
the component can be
dragged to small size, then 'snaps back' to the
minimum
I think one of the changes introduced in Java 6 is that setMinimumSize() on a Window will actually enforce the set size, meaning that the window size will "freeze" if the user tries to make it smaller. I haven't tried this myself though, so I won't vouch for it.
843805
...and I see now that the OP mentions he is already using Java 6, so never mind.
843805
Try creating the file chooser like this
                JFileChooser fc = new JFileChooser(){
                    protected JDialog createDialog(Component parent) throws HeadlessException {
                        JDialog dialog = super.createDialog(parent);
                        dialog.setMinimumSize(new Dimension(200,200));
                        return dialog;
                    }
                };
1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 1 2008
Added on Jun 30 2008
16 comments
871 views