sortable table header buttons

View: New views
1 Messages — Rating Filter:   Alert me  

sortable table header buttons

by Brian Mauter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone!  I love using SQuirreL but I have one thing I'd like  
tweaked.  On Mac OS X, JButtons render differently based on what you  
put in them.  The buttons on the table header look like rounded Aqua  
buttons normally and they change shape when you put the up/down arrow  
icons in them.  You tell the button to take a hint and render the same  
way every time.  Hopefully another benefit will be that I get to see  
more text in the header using the "square" hint.

Here are the available hints from Apple.  The Sun Swing docs indicate  
that if a platform doesn't understand a hint it ignores it, so I think  
it's safe without having to resort to OS detection.
http://developer.apple.com/mac/library/technotes/tn2007/tn2196.html#BUTTONS

Here's a patch for what I did to change it.  I can't get SQuirreL to  
run from my Eclipse.  I will be very happy to test something if anyone  
would like to add this.
### Eclipse Workspace Patch 1.0
#P sql12
Index: fw/src/net/sourceforge/squirrel_sql/fw/gui/ButtonTableHeader.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/
squirrel_sql/fw/gui/ButtonTableHeader.java,v
retrieving revision 1.9
diff -u -r1.9 ButtonTableHeader.java
--- fw/src/net/sourceforge/squirrel_sql/fw/gui/ButtonTableHeader.java
18 May 2008 16:13:13 -0000 1.9
+++ fw/src/net/sourceforge/squirrel_sql/fw/gui/ButtonTableHeader.java
4 Sep 2009 21:15:12 -0000
  /**
   * @version $Id: ButtonTableHeader.java,v 1.9 2008/05/18 16:13:13  
gerdwagner Exp $
@@ -440,9 +450,11 @@
        ButtonTableRenderer(Font font)
        {
           _buttonRaised = new JButton();
+         _buttonRaised.putClientProperty("JButton.buttonType",  
"square");
           _buttonRaised.setMargin(new Insets(0, 0, 0, 0));
           _buttonRaised.setFont(font);
           _buttonLowered = new JButton();
+         _buttonLowered.putClientProperty("JButton.buttonType",  
"square");
           _buttonLowered.setMargin(new Insets(0, 0, 0, 0));
           _buttonLowered.setFont(font);
           _buttonLowered.getModel().setArmed(true);

Here's a screenshot of what a button normally looks like and what it  
looks like after it's clicked.




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Squirrel-sql-develop mailing list
Squirrel-sql-develop@...
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop