Different look of button in jtree or jtable (windows/linux)

Hi.
I have jbutton on jtree(in jtable is the same problem) it looks like this on linux: http://mikel.pl/button.jpg .
On windows eveyrthink is ok. I tried to set RaisedBevelBorder but in this case on windows button looks awful. Is any trick to get the same look of button without checking what system is running?

Yes and no. Linux and Windows use different LookAndFeels by default, meaning the buttons are painted differently. Just setting the same border will not do in this case. The only way of having the application look exactly the same on both platforms is to manually set a LookAndFeel available on both systems. This should be the case for the MetalLookAndFeel, the SynthLookAndFeel and, I believe, for the Linux LookAndFeels as well.

Similar Messages

  • Button panel replaced by JTable result set

    Hi guys. Here's the problem. Below is my current working code.
    When run - a JOption pane opens, into which I type the database location (using /'s instead of \'s as it is a String input).
    The main UI opens. That indicates that the connection was successful. The UI consists of a JPanel (north) containg a number of buttons. Below that is a space for a JTable. Each button represents a diiferent query to the database and a different result set is displayed in the JTable beneath the buttons depending on which button is clicked.
    This all works fine.
    However I would like to now modify the code so that when the program runs the user is faced with the JPanel containing the Buttons only. And when a button is clicked the current panel is replaced with a full JTable containing the result set.
    So basically I want a JPanel with a number of buttons. Once clicked the result set JTable is displayed fully in the JFrame possibly with another button to bring the user back to the initial button panel.
    import java.io.*;
    import java.sql.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.table.*;
    public class Test12 extends JFrame {
    // java.sql types needed for database processing
    private Connection connection;
    private Statement statement;
    private ResultSet resultSet;
    private ResultSetMetaData rsMetaData;
    // javax.swing types needed for GUI
    private JTable table;
    private JTextArea inputQuery;
    public Test12()
    super( "Johnny Project" );
    // The URL specifying the Books database to which
    // this program connects using JDBC to connect to a
    // Microsoft ODBC database.
    // Load the driver to allow connection to the database
    try {
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         String myFilename = JOptionPane.showInputDialog("Enter Database Location");
                   String myDatabase = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
                   myDatabase+= myFilename.trim() + ";DriverID=22;READONLY=true}";
                   connection = DriverManager.getConnection(myDatabase,"","");
    catch ( ClassNotFoundException cnfex ) {
    System.err.println(
    "Failed to load JDBC/ODBC driver." );
    cnfex.printStackTrace();
    System.exit( 1 ); // terminate program
    catch ( SQLException sqlex ) {
    System.err.println( "Unable to connect" );
    sqlex.printStackTrace();
    System.exit( 1 ); // terminate program
              //If connection succeeds - build GUI
              buildMenu();
              buildGUI();
              setSize(800, 800);
              show();
    private void getTable(String recievedQuery)
    try {
    String query = recievedQuery;
    statement = connection.createStatement();
    resultSet = statement.executeQuery(query);
    displayResultSet(resultSet);
    catch (SQLException sqlex) {
    sqlex.printStackTrace();
    private void displayResultSet(ResultSet rs)
    throws SQLException
    // position to first record
    boolean moreRecords = rs.next();
    // If there are no records, display a message
    if (! moreRecords) {
    JOptionPane.showMessageDialog( this,
    "ResultSet contained no records" );
    setTitle( "No records to display" );
    return;
    Vector columnHeads = new Vector();
    Vector rows = new Vector();
    try {
    // get column heads
    ResultSetMetaData rsmd = rs.getMetaData();
    for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
    columnHeads.addElement( rsmd.getColumnName( i ) );
    // get row data
    do {
    rows.addElement( getNextRow( rs, rsmd ) );
    } while ( rs.next() );
    // display table with ResultSet contents
    table = new JTable( rows, columnHeads );
    JScrollPane scroller = new JScrollPane( table );
    Container c = getContentPane();
    c.remove( 1 );
    c.add( scroller, BorderLayout.CENTER );
    c.validate();
    catch ( SQLException sqlex ) {
    sqlex.printStackTrace();
    private Vector getNextRow( ResultSet rs, ResultSetMetaData rsmd )
    throws SQLException
    Vector currentRow = new Vector();
    for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
    switch( rsmd.getColumnType( i ) ) {
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
    currentRow.addElement( rs.getString( i ) );
    break;
    case Types.INTEGER:
    currentRow.addElement(
    new Long( rs.getLong( i ) ) );
    break;
    default:
    System.out.println( "Type was: " +
    rsmd.getColumnTypeName( i ) );
    return currentRow;
    public void shutDown()
    try {
    connection.close();
    catch ( SQLException sqlex ) {
    System.err.println( "Unable to disconnect" );
    sqlex.printStackTrace();
    private void buildGUI()
              inputQuery = new JTextArea(4, 30);
              Icon people = new ImageIcon("people.gif");
              JButton searchAll = new JButton("All", people);
              searchAll.setToolTipText("Search All People");
              searchAll.setBorder(null);
              searchAll.addActionListener(
         new ActionListener() {
    public void actionPerformed(ActionEvent e)
              String searchAllString = new String("Select * from 0001_per_year");
         getTable(searchAllString);
              JButton searchPathway = new JButton("Pathway", people);
              searchPathway.setToolTipText("Search Students by Pathway");     
              searchPathway.setBorder(null);
              searchPathway.addActionListener(
         new ActionListener() {
    public void actionPerformed(ActionEvent e)
              String searchPathwayString = new String("Select Student_Number, Pathway from 0001_per_year");
         getTable(searchPathwayString);
              JButton searchPeriod = new JButton("Study", people);
              searchPeriod.setToolTipText("Search Students by Period");     
              searchPeriod.setBorder(null);
              searchPeriod.addActionListener(
         new ActionListener() {
    public void actionPerformed(ActionEvent e)
              String searchPeriodString = new String("Select Student_Number, Period_of_Study from 0001_per_year");
         getTable(searchPeriodString);
              JButton searchAttendance = new JButton("Attendance", people);
              searchAttendance.setToolTipText("Search Students by Attendance");     
              searchAttendance.setBorder(null);
              searchAttendance.addActionListener(
         new ActionListener() {
    public void actionPerformed(ActionEvent e)
              String searchAttendanceString = new String("Select Student_Number, Attendance_Status from 0001_per_year");
         getTable(searchAttendanceString);
              JLabel j1 = new JLabel ();     
              JLabel j2 = new JLabel ();
              JLabel j3 = new JLabel ();
              JLabel j4 = new JLabel ();
              JLabel j5 = new JLabel ();
              JLabel j6 = new JLabel ();
              JLabel j7 = new JLabel ();
              JLabel j8 = new JLabel ();
              JLabel j9 = new JLabel ();
              JLabel j10 = new JLabel ();
              JLabel j11 =new JLabel ();
              JLabel j12 = new JLabel ();
              GridLayout grid;
              grid = new GridLayout(4,4);
                   JPanel topPanel = new JPanel();
              topPanel.setLayout(grid);
              topPanel.add(j1);
              topPanel.add(j2);
              topPanel.add(j3);
              topPanel.add(j4);
              topPanel.add(j5);
              topPanel.add(searchAll);
              topPanel.add(searchPathway);
              topPanel.add(j6);
              topPanel.add(j7);
                   topPanel.add(searchPeriod);
                   topPanel.add(searchAttendance);
                   topPanel.add(j8);
                   topPanel.add(j9);
                   topPanel.add(j10);
                   topPanel.add(j11);
                   topPanel.add(j12);
                   table = new JTable();
              Container c = getContentPane();
              c.setLayout( new BorderLayout() );
              c.add( topPanel, BorderLayout.NORTH );
              c.add( table, BorderLayout.CENTER );
              show();
    private void buildMenu()
    JMenuBar myMenuBar = new JMenuBar();
    JMenu myFileMenu = new JMenu("File");
    JMenuItem myExitItem = new JMenuItem("Exit");
    //Exit item closes the application
    myExitItem.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    System.exit(0);
    myFileMenu.add(myExitItem);
    myMenuBar.add(myFileMenu);
    setJMenuBar(myMenuBar);
    public static void main( String args[] )
    final Test12 app = new Test12();
    app.addWindowListener(
    new WindowAdapter() {
    public void windowClosing( WindowEvent e )
    app.shutDown();
    System.exit( 0 );

    Your welcome. I don't really compete for Duke's, but I'm glad the issue is resolved.
    - Saish
    "My karma ran over your dogma." - Anon

  • DnD from JTree to JTable

    Hi guys,
    It seems JTree DnD support is a quit difficult feature to implement of all swing components.
    I'm writing an application in which I have a JTree structure representing the file system of user machine and another JTable component at the right.
    I want to be able to drag files nodes from left JTree to right JTable.
    I would appreciate a lot if someone share with me some source code examples for this functionality.
    can someone post some basic java code to get me started or point me to some web resource discussing this feature?
    thanks much.

    http://forum.java.sun.com/thread.jspa?threadID=296255Thank you. I already looked at this thread but it's not what i'm looking for: it shows dnd from a JTree to another JTree..however i need to implement dnd from JTree to JTable.
    Is there some basic example on how to do that ?
    thanks.

  • How to show different Look & Feel to different users?

    Hi,
    how to show different Look & Feel to different users?
    Thanks & Regards,
    Venu--

    If you want the user to select then LookAndFeel then Visitor Tools.
    If you want to use code and dynamically change it then http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/javadoc/index.html?com/bea/netuix/laf/PortalLookAndFeel.html
    if you have only a few combinations then you could even create different desktops and direct the user to the appropriate url

  • Is there place in Aperture where a photo can be given  a different look, like a painted canvas, cartoon look, or other effects?

    Is there place in Aperture where a photo can be given  a different look, like a painted canvas, cartoon look, or other effects?

    Only by sending the photo to an external editor or using a plug-in, like Toonit (see ToonIt! For Aperture (Digital Anarchy)).
    The effects in Aperture (see the are very basic. Some simple effects Quartz Filter effects can be added by using Automator services, see my user tip here:
                     Using Quartz Filters with Aperture
    For example, using the ColorPencil effect:

  • Different look in brightness and contrast in Color as in FCP

    Hello,
    I've got a problem since the last pro applications update. Since then my clips got a different look in brightness and contrast in color as in FCP.
    If I send a clip from FCP to color, it looks more dark with higher contrast. If I send it back to FCP you can see the made changes, but the brightness is higher and contast lower again. And I mean a huge differnce between the both programs.
    Before, it was like identical. So, in the moment, it is difficult to make exact changes and the worklow is not so efficent anymore.
    Has anyone the same problems or an idea to solve the problem?
    THX

    Patrick Inhofer wrote:
    That tech note specifically discusses how FCP's assumption about RGB files forces it to handle their gamma differently than "YUV" based file formats.
    Relevant bit:
    Final Cut Pro assumes that QuickTime movies for codecs that support the YUV color space (including DV, DVCPRO 50, and the 8- and 10-bit Uncompressed 4:2:2 codecs) are created with a gamma of 2.2. This is generally true of movies captured from both NTSC and PAL sources. When you eventually output the sequence to video, or render it as a QuickTime movie, the gamma of the output is identical to that of the original, unless you've added color correction filters of your own.
    *However, during playback on your computer's monitor, Final Cut Pro automatically lowers the gamma of a sequence playing in the Canvas to 1.8 for display purposes. This is to approximate the way it will look when displayed on a broadcast monitor. This onscreen compensation does not change the actual gamma of the clips in your sequence.*
    So what's displayed in the Canvas is an approximation of the "correct" gamma and relies on many assumptions about the media that may not be accurate.

  • Add JTree in JTable

    How to add JTree in JTable?
    Please tell me?

    you need to use a TableCellRenderer, that implements your JTree, for cell renderers see http://java.sun.com/docs/books/tutorial/uiswing/components/table.html and http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#renderer
    thomas

  • Where is the button for HP Director in Windows 7?

    Where is the button for HP Director in Windows 7?  Trying to find the printer cartridge ink levels.  This is very easy to do on Canon printers.  Hopefully I can accomplish the same thing on an HP in at least a day.  I've been looking for about an hour, so far.
    Very frustrated.

    One ? should suffice, and why the capital letters?  Try to remain calm.  I know Photoshop can be frustrating, but In the grand scheme of things your inability to find a control in an application you're using really doesn't need such emphasis...  Please look up "netiquette" when you have a chance.
    Try hovering your cursor over things and look at the ToolTip help balloons that pop-up.
    You can add a Layer Mask by choosing Layer - Add Layer Mask from the menus.
    If you're seeking the icon on which to click to begin painting on a Layer Mask, this is the one you want:
    If you are talking about making layers visible or invisible, that's the little eyeball icon at the left of each layer in the Layers palette.
    -Noel

  • I am looking for a way to disable the windows ct

    rl-alt-del function in a LabVIEW 6.0 VI. I also need to disable the bottom task bar including the Start key in Windows NT 4.0. My goal is to keep the VI exclusively on the screen and disable the users from switching to other programs or shut off the PC.

    rl-alt-del function in a LabVIEW 6.0 VI. I also need to disable the bottom task bar including the Start key in Windows NT 4.0. My goal is to keep the VI exclusively on the screen and disable the users from switching to other programs or shut off the PC.Public libraries use applications like WinSelect to lock down access to machines.
    http://www.winselect.com/
    But control-alt-delete in NT4.0 is a kernel level security feature that can't be
    defeated unless you hide the keyboard. By using registry settings you can
    control what is presented to the user after he hits control-alt-delete and keep
    him/her from shutting down, but you will also have to lock up the computer to keep
    your users from hitting the reset button and hide the mouse.
    If you want to boot up an NT environment without a keyboard and mouse
    you will need to go to NT Embedded. NTE allows you to build a custom
    OS that does not require keyboard or mouse to boot. You can also install
    just the components you need, ie; no browser, menus, control panel, etc.
    Regards,
    Alan
    "Dan Huynh" wrote in message news:[email protected]..
    > I am looking for a way to disable the windows ctrl-alt-del function in
    > a LabVIEW 6.0 VI. I also need to disable the bottom task bar
    > including the Start key in Windows NT 4.0. My goal is to keep the VI
    > exclusively on the screen and disable the users from switching to
    > other programs or shut off the PC.
    >
    >

  • Hi. I am using a time capsule for few PC s. I have made 5 different account to access time capsule. but in windows when i enter account name and password for one account, i cannot access other accounts, because windows saves username

    Hi. I am using a time capsule for few PC s. I have made 5 different account to access time capsule. but in windows when I enter account name and password for one account, i cannot access other accounts, because windows saves username. how can i prevent this from happenning. I really need to access all my accounts and dont want it to save automaticlly.

    Why have 5 accounts if you need to access all of them.. just have one account?
    Sorry I cannot follow why you would even use the PC to control the Time Capsule. Apple have not kept the Windows version of the utility up to date.. so they keep making it harder and harder to run windows with apple routers.

  • How do I disable "Exceptions" button for "Block pop-up windows" in Content tab?. I am able to Disable other Exception buttons in this tab using about:config preference.

    Need a way to disable "Exception" button for "Block Pop-up windows" in Tools-> Options -> Content tab. I want to be able to do this for Locking Down Firefox preferences.
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    That button doesn't have a pref associated with it, so you can't disable that button with a pref on the about:config page or a lockPref call.
    That only leaves the choice to remove that button with code in userChrome.css
    <pre><nowiki>#popupPolicyButton {display:none!important;}</nowiki></pre>
    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files

  • I had a trial version, and tonight I bought it.  But buttons led me to the Windows version which I accidentally bought.  I have Mac.  What do I do?  How do I switch it over to a Mac version?

    I had a trial version, and tonight I bought it.  But buttons led me to the Windows version which I accidentally bought.  I have a Mac.  What do I do?  How do I switch to Mac version?

    Hi scarabs55,
    Are you working with Acrobat or Photosohp? (You mention both PDF files and photos, so it's not clear.)
    Let us know what software you're thinking about upgrading and we can point you in the right direction.
    Best,
    Sara

  • As I downloaded new software upgrade in my iPod nano 7 th gen and also new iTunes upgrade then all data on my iPod got erased and now when I am trying to sync it again then sync button is disabled on the windows screen . Kindly help

    As I downloaded new software upgrade in my iPod nano 7 th gen and also new iTunes upgrade then all data on my iPod got erased and now when I am trying to sync it again then sync button is disabled on the windows screen . Kindly help

    From the OP: "My old computer got a virus and when that happened all my music was lost. "
    They don't have the music on their computer so they cannot transfer the iTunes folder, from the computer to their iPod and then to the new computer. And if they try to enable disk use on the iPod it will erase all the music that is on it. The method you cited is moving the files in a data format using the iPod as a flash drive. It doesn't work if they are in music format. That is why I suggested Yamipod.

  • I clicked all the buttons in the file sharing window and now my iMac will not turn on.

    I really goofed. I clicked all the buttons in the file sharing window (Screen sharing;File Sharing...Remote Login; Remote Management...Internet sharing) but I did not write down the IP address and now the computer will not turn on at all. Is there a way to roll back my stupidity and get this thing to turn on again?

    There's only one thing you can do: make an appointment with Apple genius at the Apple retail store for a out of warranty replacement.

  • I am looking solutions to backup. I use windows can you help me?

    I am looking solutions to backup. I use windows can you help me?

    Hi There,
    Kindly download the Creative Cloud app from the below mentioned link. Trial would work for 30 days only.
    Creative Cloud Help | Install, update, or uninstall apps
    Thanks,
    Atul Saini

Maybe you are looking for

  • Macbook can't be found with any internet connection except with wi-fi turned on

    Just weard! - I can't find my macbook on find my iphone without wi-fi turned on. Why can and is  it normal my macbook only can be found on "find my iphone" when wifi is on while I still have another internet connection activated on my mac without wi-

  • File copy issues with Mavericks

    Why am I getting a "Item in use" error when I try to copy a file for the first time ( OS 10.9.2 ) The second attempt always happens without an issue. This happens with newly created image files OR already existing files from a server to my computer..

  • How to create a textbox and dropdown list in Java similar to google search

    Hi, I want to create a textbox and dropdown in java very much similar to google search . As user types in the letters it should display the dropdown list similar to google. Can anyone help me with this one asap. Thanks Lavanya

  • HT203167 The lion king movie no longer available

    I purchased this movie and it is no longer available I have searched the internet and I've read that Disney had taken it off of iTunes. I have also heard that it was a glitch on apples part and it if you purchased the movie you would be able to still

  • Airport Extreme conection

    I use the airport extreme as as switch and wireless AP. The connection is like this: Internet > Modem > Router > Airport Extreme > computers. From teh router to the Airport Extreme, do I use the Wan on the Airport Extreme or the LAN port? Also can th