Swing UI differs between Linux & Windows. How to fix?

I'm having some difficulties with the different look between OSes.
Well the main problem is not that it looks different but
that in linux the controls are bigger so that some controls don't fit in the window anymore:
Linux
Windows
Since I have basically mo experience with crossplatform & GUI applications,
I'm blindly trying to fix this but to no avail.
How can I correct this behaviour so it looks more like it does in Windows?
Relevant code:
JButton bFile=new JButton("Add File");
JButton bDir=new JButton("Add Dir");
JButton bRenamePattern=new JButton("Rename Config");
JPanel lowerPanel = new javax.swing.JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx=0; c.gridy=0;
c.gridwidth = GridBagConstraints.REMAINDER;
lowerPanel.add(prgbr_Progress[0],c); c.gridy++;
lowerPanel.add(prgbr_Progress[1],c); c.gridy++;
JPanel innerPanel = new javax.swing.JPanel(new GridBagLayout());
GridBagConstraints cInner = new GridBagConstraints();
cInner.gridx=0; cInner.gridy=0;
cInner.fill = GridBagConstraints.HORIZONTAL;
cInner.weightx = 1;
innerPanel.add(lblProcessedMB, cInner); cInner.gridx++;
innerPanel.add(lblTimeElapsed, cInner); cInner.gridx++;
innerPanel.add(lblTimeRemaining, cInner); cInner.gridx++;
lowerPanel.add(innerPanel,c); c.gridy++;
c.gridwidth=1;
c.weightx=0; lowerPanel.add(withLabel("Set state",comboState),c);
c.weightx=0; c.gridx++; lowerPanel.add(checkFilesWatched,c);
c.gridx++; lowerPanel.add(checkRenameFiles,c);
c.gridx++; lowerPanel.add(bRenamePattern,c);
c.gridx++; lowerPanel.add(bFile,c);
c.gridx++; lowerPanel.add(bDir,c);
c.gridx++; lowerPanel.add(bRemove,c);
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridx++; lowerPanel.add(bStart,c);
setLayout(new BorderLayout());
add(scrollPane,BorderLayout.CENTER);
add(lowerPanel,BorderLayout.SOUTH);

BoBear2681:
I can't confirm that.
The size is the same on both systems 800x600.
And if you look closely to both pictures you'll see that the font is slightly bigger on the linux system (and more spacing).
Also easlily noticable is the JTable, the entries there doesn't fit height wise (the text is capped of at the top).
Another thing is that the last row of the controls (bottom), the height is much greater.
AndrewThompson64
I also made it SSCCE:
//Applett
import javax.swing.JApplet;
@SuppressWarnings("serial")
public class Main extends JApplet {
    public static boolean runsLocally=false;
    public GUI GUI;
    public void init(){
        GUI = new GUI();
    public void start(){
         setSize(800, 600);
          add(GUI);
          System.out.println("Started");
//GUI Class
import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.*;
//Applet user interface
@SuppressWarnings("serial")
public class GUI extends javax.swing.JPanel {
    private final JProgressBar[] prgbr_Progress = new JProgressBar[] {new JProgressBar(), new JProgressBar()};
    public final JCheckBox checkFilesWatched = new javax.swing.JCheckBox("Mark Watched");
    public final JCheckBox checkRenameFiles = new javax.swing.JCheckBox("Rename Files");
    private final JComboBox comboState = new javax.swing.JComboBox();
    private final JButton bStart = new JButton("Start");
    private final JButton bRemove = new JButton("Remove");
    private final JLabel lblProcessedMB = new JLabel("0 of 0 MB processed", JLabel.CENTER);
    private final JLabel lblTimeElapsed = new JLabel("Time elapsed: 0:00:00", JLabel.CENTER);
    private final JLabel lblTimeRemaining = new JLabel("Time remaining: 0:00:00", JLabel.CENTER);
    public GUI() {
        comboState.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Unknown", "On HDD", "OnCD", "Deleted" })); //currently relying on item order
        comboState.setSelectedIndex(1);
        JScrollPane scrollPane = new javax.swing.JScrollPane();
        scrollPane.setViewportView(new javax.swing.JTable());
        JButton bFile=new JButton("Add File");
        JButton bDir=new JButton("Add Dir");
        JButton bRenamePattern=new JButton("Rename Config");
        JPanel lowerPanel = new javax.swing.JPanel(new GridBagLayout());
        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridx=0; c.gridy=0;
        c.gridwidth = GridBagConstraints.REMAINDER;
        lowerPanel.add(prgbr_Progress[0],c); c.gridy++;
        lowerPanel.add(prgbr_Progress[1],c); c.gridy++;
        JPanel innerPanel = new javax.swing.JPanel(new GridBagLayout());
        GridBagConstraints cInner = new GridBagConstraints();
        cInner.gridx=0; cInner.gridy=0;
        cInner.fill = GridBagConstraints.HORIZONTAL;
        cInner.weightx = 1;
        innerPanel.add(lblProcessedMB, cInner); cInner.gridx++;
        innerPanel.add(lblTimeElapsed, cInner); cInner.gridx++;
        innerPanel.add(lblTimeRemaining, cInner); cInner.gridx++;
        lowerPanel.add(innerPanel,c); c.gridy++;
        c.gridwidth=1;
        c.weightx=0; lowerPanel.add(withLabel("Set state",comboState),c);
        c.weightx=0; c.gridx++; lowerPanel.add(checkFilesWatched,c);
        c.gridx++; lowerPanel.add(checkRenameFiles,c);
        c.gridx++; lowerPanel.add(bRenamePattern,c);
        c.gridx++; lowerPanel.add(bFile,c);
        c.gridx++; lowerPanel.add(bDir,c);
        c.gridx++; lowerPanel.add(bRemove,c);
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.gridx++; lowerPanel.add(bStart,c);
        setLayout(new BorderLayout());
        add(scrollPane,BorderLayout.CENTER);
        add(lowerPanel,BorderLayout.SOUTH);
        validate();
    //Add a label to the left of a swing component
    public static JPanel withLabel(String s, JComponent c){
        JPanel p=new JPanel(new BorderLayout());
        p.add(new JLabel(s),BorderLayout.WEST);
        p.add(c,BorderLayout.CENTER);
        return p;
}I'll try your suggestions,
I'll post the results if I have them.

Similar Messages

  • Training: Difference between Linux & Windows platform courses?

    Hello,
    I'm interested in taking the 5 day course 'BEA WebLogic Server 8.1: System Administration'. But I'm noticing that almost all the courses, on this topic, offered are on the Windows Platform and very few are on the Linux platform (at my firm, WebLogic is run on Linux servers).
    Can anyone tell me if I'd be okay with taking the 'Window's Platform' course? Or would I be wasting my time (and the companie's money) because there's too big a variance between platforms for the WebLogic training?
    Thanks very much.
    - Lincoln

    Since you are going for System administration it would be better if you go for the Linux platform course. I am sure there will be a lot of troubleshooting you'll need to do looking at it from an OS point of view.

  • Why differing Character Encoding and how to fix it?

    I have PRS-950 and PRS-350 readers, both since 2011.  
    In the last year, I've been getting books with Character Encoding that is not easy to read.  In playing around with my browsers and View -> Encoding menus, I have figured out that it has something to do with the character encoding within the epub files.
    I buy books from several ebook stores and I borrow from the library.
    The problem may be the entire book, but it is usually restricted to a few chapters, with rare occasion where the encoding changes within a chapter.  Usually it is for a whole chapter, not part, and it can be seen in chapters not consecutive to each other.
    It occurs whether the book is downloaded directly to my 950 reader or if I load it to either reader from my computer(s), which are all Mac OS X of several versions fom 10.4 to Mountain Lion.  SInce it happens when the book is downloaded directly, I figure the operating system of my computer is not relevant.
    There are several publishers involved, though Baen (no DRM ebooks) has not so far been one of them.
    If I look at the books with viewers on the computer, the encoding is the same.  I've read them in Calibre, in the Sony Reader App, and in Adobe Digital Editions 2.0.  It's always the same.
    I believe the encoding is inherent to the files.  I would like to fix this if I can to make the books I've purchased, many of them in paper and electronically, more enjoyable to read on my readers.
    Example: I’ve is printed instead of I've.
    ’ for apostrophe
    “ the opening of a quotation,
    â€?  for closing the quotation,
    and I think — is for a hyphen.
    When a sentence had “’m  for " 'm at the beginning of a speech (when the character was slurring his words) it took me a while to figure out how it was supposed to read.
    “’Sides, â€™tis only for a moon.  That ain’t long.â€?
    was in one recent book.
    Translation: " 'Sides, 'tis only for a moon. That ain't long."
    See what I mean? 
    Any ideas?

    Hi
    I wonder if it’s possible to download a free ebook with such issue, in order to make some “tests”.
    Perhaps it’s possible, on free ebooks (without DRM), to add fonts by using softwares like Sigil.

  • I have two firefox browsers open and it randomly keeps switching between the two, how to fix

    When I'm not minimized to copy data from one open browser to the other, I have them maximized. I'll be on one and randomly firefox will switch to the other. Very frustrating. Thanx

    Are that windows in the same Firefox instance or do you have multiple Firefox instances open with separate profiles by using the -no-remote command line switch?
    *http://kb.mozillazine.org/Opening_a_new_instance_of_Firefox_with_another_profile
    Note that it is possible that a window takes focus if there are plugin-container processes active that try to take the focus.
    *https://support.mozilla.org/kb/Troubleshooting+plugins

  • How can I switch between multiple windows of the same application (e.g. Safari) over several desktops ?

    Hi All,
    I have one application, for example safari, open and running with multiple windows (with or without tabs) spread over several desktops.
    How can I switch between the windows only via keyboard? CMD+> and CMD+< let me only swicht between windows open on the one desktop I am currently looking at.
    thanks for your replies,
    equi

    Barney,
    many thanks for your efforts and your time (preparing and posting the screenshot, answering to this question,...).
    Unfortunately, moving the focus to the next window only works with windows on the same desktop.
    btw, using a german keyboard layout and german language settings the shortcut is "cmd+<".
    I can switch with this shortcut between different windows of my Safari which reside on the same desktop, but I cannot swith between different safari windows distributed over several desktops.
    Thanks,
    equi    

  • How can we navigate between two windows of same component in webdynpro ABAP

    Hi
    how can we navigate between two windows( not views ) of same component in webdynpro ABAP. its an urgent requirement
    Thanks in advance.
    Regards
    Laeeq

    Hi Laeeq,
    You cannot navigate between windows of one component. You can only call a dialog box showing the contents of a second window, or you can embed the contents of a window of a different component.
    Just add all the views you need to the one and only main window of the component.
    Ciao, Regina

  • Different Text Sizes Linux / Windows

    Anyone know anything about this? This is the same code, but
    it displays differently on Linux than Windows. There shouldn't be a
    scrollbar on the Linux / Firefox window. I know I'm running IE in
    Linux, but it's the same result as if I was running it in Windows.
    Firefox in Windows displays correctly also.
    IE
    Firefox

    maitlandclark wrote:
    > I'm making a simple navbar with 5 buttions, one button
    needs 4 words of text so
    > I need to make the font smaller for this button. But I
    don't know how to change
    > the size for that button without changing the size of
    the text for all buttons,
    > I end up having the one word buttons having far too
    small font size. Any ideas?
    Why not have the size of that button lage enough to
    accomodate the text?
    Buttons don't all have to be the same size. If you still want
    it the
    same size as the others, you'll need to create a new button
    symbol for
    the one with smaller text.
    Linda Rathgeber [PVII] *Adobe Community Expert-Fireworks*
    http://www.projectseven.com
    Fireworks Newsgroup:
    news://forums.projectseven.com/fireworks/
    CSS Newsgroup: news://forums.projectseven.com/css/

  • How to switch between 2 windows of the same application using Cmd+Tab

    Hi,
    I am using my mac now since about 10 months. I was used to work with Linux and Windows XP.
    Something I am badly missing on mac os x is the possibility to switch between 2 windows of the same application using cmd + tab just like it simply works for Linux and Windows (and maybe many other OS out there!).
    Very often I have 2 text files open in 2 editor windows (e.g. TextEdit) and need to copy and paste text from one window to the other. I was used to simply use ALT+TAB. But here I have to get my right hand away from the keyboard and use the mouse to change the focus from one window to the other and then use the mouse again to get the focus back to the previous TextEdit windows.
    THIS REALLY *****!!!! It makes me crazy. I cannot believe that such a "modern" OP does not support this action. I must be doing something completely wrong or did not understand the mac correctly. Right?
    Does anyone have an idea how I can get mac to do something all other operating systems so easily do?
    Thanks
    Quartz84

    Hi Kappy,
    well what you are saying is obvious to me. This is not the point for me and not what I wanted to know. But I think you answered my question anyway: OS X is unable to switch between windows of the same application as I mentioned in my example.
    WHY NOT???
    Every other OS is able to differentiate between windows and not just applications.
    Another example: The Mail application and an Email editor window. When you are writing an Email and you want to switch to the main window of the Mail application to read something you must again use the mouse!
    I mean Apple seems to be "somehow" using FreeBSD in the background and even in FreeBSD's window manager it is possible to switch between windows of the same application.
    Well, in the Apple world it is always the pour user who is not intelligent enough to understand Apple's philosophy ;-(
    To me this is not modern, it is simply a weakness of the OS.
    Cheers
    Quartz84

  • Oracle weirdness between Linux and Windows........Any ideas??

    Hi,
    I'm connecting to the same database which is on a linux server.....
    This is the weirdness I'm getting...
    ---Connecting via SQLDeveloper in Linux (ubuntu), I'm running the following:
    desc message_instance_attr
    Name                           Null     Type                                                                                                                                                                                         
    INSTANCE_NO                    NOT NULL NUMBER(10)                                                                                                                                                                                   
    A_NAME                              NOT NULL VARCHAR2(32 CHAR)                                                                                                                                                                            
    A_VALUE                            VARCHAR2(1024 CHAR)                                                                                                                                                                          
    OWNER                              NOT NULL VARCHAR2(3 CHAR)                                                                                                                                                                             
    LAST_UPDATED_DATE       DATE                                                                                                                                                                                         
    UPDATE_COUNT                NOT NULL NUMBER(8)                                                                                                                                                                                    
    6 rows selected----Connecting via SQL plus to the same database in Windows:
    SQL> desc message_instance_attr
    Name                                      Null?    Type
    INSTANCE_NO                               NOT NULL NUMBER(10)
    A_NAME                                        NOT NULL VARCHAR2(128)
    A_VALUE                                      VARCHAR2(4000)
    OWNER                                        NOT NULL VARCHAR2(12)
    LAST_UPDATED_DATE                 DATE
    UPDATE_COUNT                          NOT NULL NUMBER(8).
    Why is the Datatype limit different between the two even thoughI'm connected to the same database? for example why is A_VALUE on Linux VarChar2 (1024) and in Windows VarChar2 (4000)
    Thanks!

    Check this link -
    http://download.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm
    DESC is not standard SQL. It is SQL*Plus specific.
    Many tools may allow desc commands to describe the table structure - but not sure whether they act the same way.
    Why don't you use DESC from SQL*Plus from both windows & linux and let us know the output?
    Regards.
    Satyaki De.

  • HT202213 My wife and I have different iTune accounts.  How do we share purchaed content between our ipads and iphones?

    My wife and I have different iTune accounts.  How do we share purchaed content between our ipads and iphones?

    iTunes- How to share music between different user accounts on a single computer
    You cannot merge two separate libraries across user accounts. Photos does not have the function of merging different Photos.library files. If you have Aperture then you can merge the two before migrating over to Photos.

  • How the implementation differs between BW and BI , Is BI takes more time fo

    Hi All,
    I would like to know difference between implemenation and time lines for MM as mentioned below.
    How the implementation differs between BW and BI , Is BI takes more time for implementing MM module  than on BW?
    Thanks in advanced. (Full points will be awarded)
    With Regards,
    PCR

    Hi Timo,
    Thanks for response!
    But as i read from the following url: http://docs.oracle.com/cd/E15051_01/apirefs.1111/e10653/oracle/jbo/ViewObject.html, the setQueryTimeOut(int timeOutMills), the timeOut is mentioned in milliseconds. Please correct me if I am wrong.
    and i have overriden the executeQuery() method in the View Object Impl class as shown below:
    public void executeQuery() {
    Map sessionScope = ADFContext.getCurrent().getSessionScope();
    sessionScope.put("MyQuery", this);
    try {
    super.executeQuery();
    } finally {
    sessionScope.remove("MyQuery");
    throw new JboException("Query Taking too long to respond");
    and in the JAVA class i am calling the above method like this:
    monitor.setQueryTimeOut(6);
    monitor.executeQuery();
    But the issue is:
    1. The above exception message is getting carried forward to other pages as well. I mean somewhere in the session/ADFContext this message is being saved and error comes up/pops up when i click on other tabs of the page. How do i clear this?
    2. The above exception message is coming for the first time but when i click the 'Submit' button second time, i am getting the results and also the message that 'Query is taking too long to respond'. This should not be the case, everytime it should show the same message as the timeout limit is less and the query should end without fetching the results.
    Kindly let me know how to resolve the above issues, any pointers will be helpful.
    Thanks in advance.
    Edited by: user9223904 on Nov 3, 2012 4:42 AM

  • I linux inode which contains 13 member array wich stores the actual block address of data .Similarly in windows how data is managed in disk ?. How many members in this array ?

    I linux inode which contains 13 member array wich stores the actual block address of data .Similarly in windows how data is managed in disk ?. How many members in this array ?

    Hello Vijay Nerkar,
    Your question is not related to Windows Forms General. What is the data you mean and also what is that array?
    If you are looking for something related to Windows File System, see some words here:
    http://en.wikipedia.org/wiki/File_system
    For example
    "Windows makes use of the
    FAT, NTFS,
    exFAT and ReFS file systems (the last of these is only supported and usable in
    Windows Server 2012; Windows cannot boot from it).
    Windows uses a drive letter abstraction at the user level to distinguish one disk or partition from another. For example, the
    path <tt>C:\WINDOWS</tt> represents a directory <tt>WINDOWS</tt> on the partition represented by the letter C. Drive C: is most commonly used for the primary hard disk partition, on which Windows is usually installed and from which it boots. This "tradition"
    has become so firmly ingrained that bugs exist in many applications which make assumptions that the drive that the operating system is installed on is C. The use of drive letters, and the tradition of using "C" as the drive letter for the primary hard disk
    partition, can be traced to
    MS-DOS, where the letters A and B were reserved for up to two floppy disk drives. This in turn derived from
    CP/M in the 1970s, and ultimately from IBM's
    CP/CMS of 1967.
    For more details, consider consult on MS Answers:
    http://answers.microsoft.com/en-us/windows
    Regards,
    Barry Wang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • When used as an Activex control in windows How can I prevent the "Q" logo from appearing between streaming videos?

    When used as an Activex control in windows How can I prevent the "Q" logo from appearing between streaming videos?

    Hello Cgifford,
    Welcome to National Instruments Forums.
    To output your signal to the PFI lines,
    you can use external connectios between OUT0 and PFI lines. You can also use
    the backplane to do so by routing into the same RTSI line.
    1)
    On the SCOPE and FGEN, the name of the
    terminals are actually “PXI Trigger Line x/RTSIx” but on the 6602 you might
    need to route the signal using the property:
    You can also use the DAQmx route signal which perform the same opperation.
    2)
    This will depend on the frequency of
    your pulse train. If this is lower than about 10 ms, then you can probably
    place this on a loop and start and stop the acquisition every time. If the
    frequency is higher than this, you will have to use:
    -       Scripting on the FGEN side (read more)
    -       MultiRecord Fetch (more information in the scope help file
    section “Acquisition Functions Reading versus Fetching”).
    3)
    The short answer is yes. The longer one
    might depend on how tight you need the synchronization to be (us, ns, ps). For
    very tight synchronization, you should look into here.
    Message Edited by Yardov on 06-18-2007 03:14 PM
    Gerardo O.
    RF Systems Engineering
    National Instruments
    Attachments:
    property.JPG ‏7 KB

  • How can you tell the differance between an iphone charger and an ipad charger?

    how can you tell the differance between an iphone and ipad charger

    http://store.apple.com/us/product/MC359LL/A/apple-ipad-10w-usb-power-adapter?fno de=3c
    http://store.apple.com/us/product/MD810LL/A/apple-5w-usb-power-adapter?fnode=48

  • Problems using RMI between linux and windows.

    I have problems using RMI between linux and windows.
    This is my scenario:
    - Server running on linux pc
    - Clients running on linux and windows PCs
    When a linux client disconnect, first time that server try to call a method of this client, a rmi.ConnectException is generated so server can catch it, mark the client as disconnected and won't communicate with it anymore.
    When a windows client (tested on XP and Vista) disconnect, no exceptions are generated (I tryed to catch all the rmi exception), so server cannot know that client is disconnected and hangs trying to communicate with the windows client.
    Any ideas?
    Thanks in advance.
    cambieri

    Thanks for your reply.
    Yes, we are implementing a sort of callback using Publisher (remote Observable) and Subscribers (remote Observer). The pattern and relative code is very well described at this link: http://www2.sys-con.com/ITSG/virtualcd/java/archives/0210/schwell/index.html (look at the notifySubscribers(Object pub, Object code) function).
    Everything works great, the only problem is this: when a Publisher that reside on a Linux server try to notify something to a "dead" Subscriber that reside on a Windows PC it does't receive the usual ConnectException and so tends to hang.
    As a workaround we have solved now starting a new Thread for each update (notification), so only that Thread is blocked (until the timeout i guess) and not the entire "notifySubscribers" function (that contact all the Subscribers).
    Beside this, using the Thread seem to give us better performance.
    Is that missed ConnectException a bug? Or we are just making some mistake?
    We are using java 6 and when both client and server are Linux or Windows the ConnectException always happen and we don't have any problem.
    I hope that now this information are enough.
    Thanks again and greetings.
    O.C.

Maybe you are looking for

  • Send html page (with images) using sockets

    I am trying to implement http and am coding this using sockets. So it is a simple client-server set up where the browser queries my server for a webpage and it should be shown. The html itself is fine, but I can't get any of the images to show up! Al

  • JSP:useBean in Tomcat with external libraries

    Hi! I would like to use netbeans 4.1 for developing jsp-pages, but are facing a problem when trying to use the built-in jsp compiler. in my code I use something like: <jsp:useBean id="id" class="package.Classname" scope="application" />while package

  • Force quitting applications isn't working

    Hi there, I have some applications that aren't working properly and when I force quit them the curser just spins and spins but doesn't shut down the application. How do you shut app's down when the force quit function doesn't do it? Thanks!

  • 4th gen ipod shuffle not recognised in windows

    I have just bought this ipod shuffle new 4th gen and cannot get windows vista or xp to recognse it. The cable is pushed in fully and have tried changing ports but still no connection. Have also tried turning on and off etc but no luck. Any suggestion

  • Anyone see a SQL syntax error here?

    Hey all, I am getting an error due to a SQL syntax error. I thought this looked good...but maybe a couple more sets of eyes looking at it will see what I did... here it is: stmt.executeUpdate("UPDATE member SET (Age = '" + Agetxf.getText() + "' Locat