Skip to content

Commit 4c22750

Browse files
committed
GUI tweaks (mainly to improve rendering in Ubuntu 14.10)
1 parent c60e244 commit 4c22750

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

BAR/src/main/java/bar/plugin/Commander.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import javax.swing.SwingUtilities;
7575
import javax.swing.ToolTipManager;
7676
import javax.swing.UIManager;
77+
import javax.swing.border.EmptyBorder;
7778
import javax.swing.event.ChangeEvent;
7879
import javax.swing.event.DocumentEvent;
7980
import javax.swing.event.DocumentListener;
@@ -200,7 +201,6 @@ void runInteractively() {
200201

201202
// Create search prompt
202203
prompt = new JTextField(PROMPT_PLACEHOLDER);
203-
prompt.setFont(prompt.getFont().deriveFont(15f));
204204
prompt.selectAll();
205205
prompt.getDocument().addDocumentListener(this);
206206
prompt.addActionListener(this);
@@ -262,22 +262,26 @@ public void itemStateChanged(final ItemEvent ie) {
262262

263263
// Create the 'history' button and blend it with prompt
264264
final Icon icon = UIManager.getIcon("Table.descendingSortIcon");
265-
historyButton = new JButton(" ", icon);
265+
historyButton = new JButton(icon);
266266
historyButton.setBackground(prompt.getBackground());
267-
historyButton.setBorder(null);
267+
historyButton.setBorder(new EmptyBorder(0, 0, 0, 4));
268268
historyButton.addActionListener(this);
269269

270-
// Create search panel: a unified component with looking like a JTextField
270+
// Create search panel: a unified component looking like a JTextField
271271
final JPanel promptPanel = new JPanel(new BorderLayout());
272272
promptPanel.add(prompt, BorderLayout.CENTER);
273273
promptPanel.add(historyButton, BorderLayout.LINE_END);
274274
promptPanel.setBackground(prompt.getBackground());
275275
promptPanel.setBorder(prompt.getBorder() );
276-
prompt.setBorder(null);
277276

278-
// Place everything into a final container
277+
prompt.setBorder(new EmptyBorder(4, 4, 4, 4));
278+
prompt.setFont(prompt.getFont().deriveFont(15f));
279+
historyButton.setContentAreaFilled(false);
280+
281+
// Place all search-related components into a final container
279282
final JPanel searchPanel = new JPanel(new BorderLayout());
280-
searchPanel.add(promptPanel, BorderLayout.CENTER);
283+
promptPanel.validate();
284+
searchPanel.add(promptPanel, BorderLayout.CENTER);
281285
searchPanel.add(cboxPanel, BorderLayout.PAGE_END);
282286
searchPanel.setFocusable(true);
283287

@@ -533,7 +537,7 @@ void showHistoryMenu() {
533537
mi.addActionListener(al);
534538
popup.add(mi);
535539
}
536-
popup.show(historyButton, historyButton.getWidth() / 2, 0);
540+
popup.show(historyButton, 0, 0);
537541
}
538542

539543
/**

0 commit comments

Comments
 (0)