Note that there are some explanatory texts on larger screens.

plurals
  1. POShifted text in swing app on OS X
    text
    copied!<p>I have a little java+swing app. Until now it worked OK, on OS X and on windows.</p> <p>But recenly a user has noticed that on his OS X (version unknown yet, nor the java version) that all texts in the GUI are shifted up and cut (as you can see on the screenshot).</p> <p><a href="http://b3.s3.quickshareit.com/picture1ac6aa.png" rel="nofollow noreferrer">wrong look http://b3.s3.quickshareit.com/picture1ac6aa.png</a></p> <p>And HTML link is shifted down and cut. All those elements are JLabels.</p> <p>This is how it should look like</p> <p><a href="http://b1.s3.quickshareit.com/screenshot_45f5e29f947e59b81.png" rel="nofollow noreferrer">ok look http://b1.s3.quickshareit.com/screenshot_45f5e29f947e59b81.png</a></p> <p>Any ideas/help? Has anybody had this problem before? I have no clue where to start. Thanks for any help</p> <p>I googled "java jlabel crop/cut" etc.</p> <p>==========</p> <p>fragment of the code</p> <pre><code>import java.awt.Insets; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import System.DnDList; import System.QSTWindow; import System.configuration.Configuration; public class Test extends JFrame { private static final long serialVersionUID = 8698865819017225558L; public static void main(String[] args) { Test main = new Test(); main.setVisible(true); } private JPanel down_panel; private JButton b_Preferences; private JButton b_AddFile; private JButton b_Send2; private JButton b_Cancel; private JButton b_Cancel2; private DnDList dndList; private JLabel filesToSendLabel; private JLabel browseFilesLabel; private JPanel selectedFilesPanel; private JPanel gPanel; public Test() { this.setLayout(null); this.setBackground(new java.awt.Color(255, 255, 255)); // XXX move color to configuration class this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setSize(360, 525); // whole window gPanel = new JPanel(); gPanel.setLayout(null); gPanel.setBackground(new java.awt.Color(255, 255, 255)); gPanel.setBounds(0, 0, 365, 525); // whole window panel selectedFilesPanel = new JPanel(); selectedFilesPanel.setLayout(null); selectedFilesPanel.setBounds(0, 333, 440, 122); selectedFilesPanel.setBackground(new java.awt.Color(255, 255, 255)); down_panel = new JPanel(); // panel with info button and upload button down_panel.setLayout(null); down_panel.setBackground(new java.awt.Color(255, 255, 255)); down_panel.setBounds(0, 430, 365, 80); // icon taken from http://en.wikibooks.org/wiki/Image:Information_icon.svg b_Preferences = new JButton("PREF"); b_Preferences.setFocusPainted(false); b_Preferences.setToolTipText("Settings"); b_Preferences.setBackground(Configuration.getBACKGROUND_COLOR()); b_Preferences.setBounds(11, 25, 32, 32); b_Preferences.setMargin(new Insets(0, 0, 0, 0)); b_Preferences.setBorderPainted(false); b_AddFile = new JButton("Browse"); b_Send2 = new JButton(new ImageIcon(QSTWindow.class.getResource("upload.png"))); b_Cancel = new JButton("Cancel"); b_Cancel2 = new JButton("Cancel"); dndList = new DnDList(selectedFilesPanel, 8, 10, 364, 97, this); filesToSendLabel = new JLabel("Media to send"); filesToSendLabel.setFont(Configuration.getDEFAULT_LABEL_FONT()); filesToSendLabel.setBounds(10, 325, 150, 14); browseFilesLabel = new JLabel("&lt;HTML&gt;&lt;U&gt;Browse&lt;/U&gt;&lt;/HTML&gt;"); browseFilesLabel.setForeground(Configuration.getLINK_COLOR()); browseFilesLabel.setFont(Configuration.getLINK_FONT()); browseFilesLabel.setBounds(90, 325, 50, 14); b_Send2.setBounds(272, 25, 72, 26); b_Send2.setMargin(new Insets(3, 0, 3, 0)); down_panel.add(b_Preferences); down_panel.add(b_Send2); gPanel.add(filesToSendLabel); gPanel.add(browseFilesLabel); gPanel.add(selectedFilesPanel); gPanel.add(down_panel); this.add(gPanel); this.setResizable(false); } } </code></pre> <p>Sorry that this example is not compillable (you'd need half of the app), but shows the problematic elements.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload