@@ -196,7 +196,7 @@ public MainWindow() throws IOException {
196196 mainFrame .setDefaultCloseOperation (JFrame .EXIT_ON_CLOSE );
197197 mainFrame .setLayout (new GridBagLayout ());
198198
199- createUI (mainFrame .getContentPane ());
199+ createUI (( JPanel ) mainFrame .getContentPane ());
200200 pack ();
201201
202202 loadHistory ();
@@ -282,15 +282,15 @@ private boolean isCollapsed() {
282282 && !configurationPanel .isVisible ());
283283 }
284284
285- private void createUI (Container pane ) {
285+ private void createUI (JPanel pane ) {
286286 // If creating the tray icon fails, ignore it.
287287 try {
288288 setupTrayIcon ();
289289 } catch (Exception e ) {
290290 LOGGER .warn (e .getMessage ());
291291 }
292292
293- EmptyBorder emptyBorder = new EmptyBorder (5 , 5 , 5 , 5 );
293+ pane . setBorder ( new EmptyBorder (5 , 5 , 5 , 5 ) );
294294 GridBagConstraints gbc = new GridBagConstraints ();
295295 gbc .fill = GridBagConstraints .HORIZONTAL ;
296296 gbc .weightx = 1 ;
@@ -364,7 +364,6 @@ public void replace(FilterBypass fb, int offset, int length, String text, Attrib
364364 } catch (Exception ignored ) {
365365 }
366366 JPanel ripPanel = new JPanel (new GridBagLayout ());
367- ripPanel .setBorder (emptyBorder );
368367
369368 gbc .fill = GridBagConstraints .BOTH ;
370369 gbc .weightx = 0 ;
@@ -391,7 +390,6 @@ public void replace(FilterBypass fb, int offset, int length, String text, Attrib
391390 openButton = new JButton ();
392391 openButton .setVisible (false );
393392 JPanel statusPanel = new JPanel (new GridBagLayout ());
394- statusPanel .setBorder (emptyBorder );
395393
396394 gbc .gridx = 0 ;
397395 gbc .weightx = 1 ;
@@ -408,12 +406,10 @@ public void replace(FilterBypass fb, int offset, int length, String text, Attrib
408406 gbc .gridwidth = 1 ;
409407
410408 JPanel progressPanel = new JPanel (new GridBagLayout ());
411- progressPanel .setBorder (emptyBorder );
412409 statusProgress = new JProgressBar (0 , 100 );
413410 progressPanel .add (statusProgress , gbc );
414411
415412 JPanel optionsPanel = new JPanel (new GridBagLayout ());
416- optionsPanel .setBorder (emptyBorder );
417413 optionLog = new JButton (Utils .getLocalizedString ("Log" ));
418414 optionHistory = new JButton (Utils .getLocalizedString ("History" ));
419415 optionQueue = new JButton (Utils .getLocalizedString ("queue" ));
@@ -435,6 +431,13 @@ public void replace(FilterBypass fb, int offset, int length, String text, Attrib
435431 } catch (Exception e ) {
436432 LOGGER .warn (e .getMessage ());
437433 }
434+
435+ // Prevent button sizes/positions from shifting when text bolds/unbolds
436+ optionLog .setPreferredSize (optionLog .getPreferredSize ());
437+ optionHistory .setPreferredSize (optionHistory .getPreferredSize ());
438+ optionQueue .setPreferredSize (optionQueue .getPreferredSize ());
439+ optionConfiguration .setPreferredSize (optionConfiguration .getPreferredSize ());
440+
438441 gbc .gridx = 0 ;
439442 optionsPanel .add (optionLog , gbc );
440443 gbc .gridx = 1 ;
@@ -445,7 +448,6 @@ public void replace(FilterBypass fb, int offset, int length, String text, Attrib
445448 optionsPanel .add (optionConfiguration , gbc );
446449
447450 logPanel = new JPanel (new GridBagLayout ());
448- logPanel .setBorder (emptyBorder );
449451 logText = new JTextPane ();
450452 logText .setEditable (false );
451453 JScrollPane logTextScroll = new JScrollPane (logText );
@@ -459,7 +461,6 @@ public void replace(FilterBypass fb, int offset, int length, String text, Attrib
459461 gbc .weighty = 0 ;
460462
461463 historyPanel = new JPanel (new GridBagLayout ());
462- historyPanel .setBorder (emptyBorder );
463464 historyPanel .setVisible (false );
464465 historyPanel .setPreferredSize (new Dimension (300 , 250 ));
465466
@@ -541,7 +542,6 @@ public void setValueAt(Object value, int row, int col) {
541542 gbc .ipady = 0 ;
542543 JPanel historyButtonPanel = new JPanel (new GridBagLayout ());
543544 historyButtonPanel .setSize (new Dimension (300 , 10 ));
544- historyButtonPanel .setBorder (emptyBorder );
545545 gbc .gridx = 0 ;
546546 historyButtonPanel .add (historyButtonRemove , gbc );
547547 gbc .gridx = 1 ;
@@ -555,7 +555,6 @@ public void setValueAt(Object value, int row, int col) {
555555 historyPanel .add (historyButtonPanel , gbc );
556556
557557 queuePanel = new JPanel (new GridBagLayout ());
558- queuePanel .setBorder (emptyBorder );
559558 queuePanel .setVisible (false );
560559 queuePanel .setPreferredSize (new Dimension (300 , 250 ));
561560 queueListModel = new DefaultListModel <>();
@@ -582,7 +581,6 @@ public void setValueAt(Object value, int row, int col) {
582581 gbc .ipady = 0 ;
583582
584583 configurationPanel = new JPanel (new GridBagLayout ());
585- configurationPanel .setBorder (emptyBorder );
586584 configurationPanel .setVisible (false );
587585
588586 // TODO Configuration components
0 commit comments