smrealms / TheLazyTrader

A route generator using .smr files
1 stars 2 forks source link

Text input boxes are too small on linux #10

Closed hemberger closed 1 year ago

hemberger commented 3 years ago

Don't know if this is a linux-specific thing, but on Ubuntu 20.04 w/ openjdk 11.0.9.1 2020-11-04, the text in input boxes gets cut off:

image

w5922xd commented 1 year ago

Same problem here with Windows 10 22H2. Made some UI changes to improve display.

  1. Change initial height for JComponent from 20 to 25 in TheLazyTraderPanel.java. Yours looks worse than mine and makes me wonder if you might need additional height.

    protected JPanel createLabelJComponentPair(String label, JComponent jc, int width) {
    JPanel jp = new JPanel();
    jp.add(new JLabel(label));
    jc.setPreferredSize(new Dimension(width, 25));  //height changed from 20 to 25
    jp.add(jc);
    return jp;
    }
  2. I turned off the vertical scrollbar in TradeRoutesPanel.java for this panel. This one is optional just my quick way of removing something that annoyed me.

    // Third Row
    {
    JPanel jpOptions = new JPanel();
    jpOptions.add(createLabelJComponentPair("Galaxy: ", selectGalaxy, 120));
    jpOptions.add(createLabelJComponentPair("Display Type: ", selectDisplayType, 135));
    jpOptions.add(createLabelJComponentPair("Max ports: ", selectNumberPorts, 40));
    jpOptions.add(createLabelJComponentPair("Routes for port: ", routesForPort, 60));
    jpOptions.add(createLabelJComponentPair("Number of routes: ", selectNumberOfRoutes, 60));
    jpOptions.add(createLabelJComponentPair("Max Dist: ", selectMaxDistance, 60));
    jpOptions.add(createLabelJComponentPair("Start Sector: ", selectStart, 60));
    jpOptions.add(createLabelJComponentPair("End Sector: ", selectEnd, 60));
    
    // After Last
    jsp = new JScrollPane(jpOptions);
    jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); //disable vertical scroll bar
    gbl.setConstraints(jsp, c);
    add(jsp);
    }

Blunt solution but I didn't want to spend much time with it.