* fix image button size issues

This commit is contained in:
Reinhard Pointner 2015-05-25 09:10:55 +00:00
parent 3c406819d0
commit 18afec0593
4 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package net.filebot.ui.rename;
import static net.filebot.util.ui.SwingUI.*;
import static java.awt.Font.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
@ -120,7 +121,7 @@ class HistoryDialog extends JDialog {
content.add(new JLabel("Filter:"), "gap indent:push");
content.add(filterEditor, "wmin 120px, gap rel");
content.add(new JButton(clearFilterAction), "w 24px!, h 24px!, gap right indent, wrap");
content.add(createImageButton(clearFilterAction), "w pref!, h pref!, gap right indent, wrap");
content.add(createScrollPaneGroup("Sequences", sequenceTable), "growx, wrap paragraph");
content.add(createScrollPaneGroup("Elements", elementTable), "growx, wrap paragraph");
@ -327,7 +328,7 @@ class HistoryDialog extends JDialog {
}
};
private final Action clearFilterAction = new AbstractAction(null, ResourceManager.getIcon("edit.clear")) {
private final Action clearFilterAction = new AbstractAction("Clear Filter", ResourceManager.getIcon("edit.clear")) {
@Override
public void actionPerformed(ActionEvent e) {
@ -418,6 +419,7 @@ class HistoryDialog extends JDialog {
public RevertSelectionAction(Collection<Element> elements) {
super("Revert...", HistoryDialog.this);
putValue(SMALL_ICON, ResourceManager.getIcon("action.revert"));
putValue(ELEMENTS, elements.toArray(new Element[0]));
}
@ -433,7 +435,6 @@ class HistoryDialog extends JDialog {
public RevertAction(String name, HistoryDialog parent) {
putValue(NAME, name);
putValue(SMALL_ICON, ResourceManager.getIcon("action.revert"));
putValue(PARENT, parent);
}

View File

@ -115,14 +115,14 @@ class SubtitleDownloadComponent extends JComponent {
fileList.setDragEnabled(true);
fileList.addMouseListener(fileListMouseHandler);
JButton clearButton = new JButton(clearFilterAction);
JButton clearButton = createImageButton(clearFilterAction);
clearButton.setOpaque(false);
setLayout(new MigLayout("nogrid, fill", "[fill]", "[pref!][fill]"));
add(new JLabel("Filter:"), "gap indent:push");
add(filterEditor, "wmin 120px, gap rel");
add(clearButton, "w 24px!, h 24px!");
add(clearButton, "w pref!, h pref!");
add(new JScrollPane(packageList), "newline, hmin 80px");
JScrollPane scrollPane = new JScrollPane(fileList);
@ -329,7 +329,7 @@ class SubtitleDownloadComponent extends JComponent {
}
}
private final Action clearFilterAction = new AbstractAction(null, ResourceManager.getIcon("edit.clear")) {
private final Action clearFilterAction = new AbstractAction("Clear Filter", ResourceManager.getIcon("edit.clear")) {
@Override
public void actionPerformed(ActionEvent e) {

View File

@ -82,7 +82,7 @@ public class SubtitleViewer extends JFrame {
content.add(new JLabel("Filter:"), "gap indent:push");
content.add(filterEditor, "wmin 120px, gap rel");
content.add(new JButton(clearFilterAction), "w 24px!, h 24px!, wrap");
content.add(createImageButton(clearFilterAction), "w pref!, h pref!, wrap");
content.add(new JScrollPane(subtitleTable), "grow");
JComponent pane = (JComponent) getContentPane();
@ -234,7 +234,7 @@ public class SubtitleViewer extends JFrame {
return infoLabel;
}
private final Action clearFilterAction = new AbstractAction(null, ResourceManager.getIcon("edit.clear")) {
private final Action clearFilterAction = new AbstractAction("Clear Filter", ResourceManager.getIcon("edit.clear")) {
@Override
public void actionPerformed(ActionEvent e) {

View File

@ -31,6 +31,7 @@ import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.event.MouseInputListener;
@ -38,6 +39,8 @@ import javax.swing.plaf.basic.BasicTableUI;
import javax.swing.text.JTextComponent;
import javax.swing.undo.UndoManager;
import net.filebot.Settings;
public final class SwingUI {
public static void checkEventDispatchThread() {
@ -89,7 +92,8 @@ public final class SwingUI {
button.setHideActionText(true);
button.setToolTipText(String.valueOf(action.getValue(Action.NAME)));
button.setOpaque(false);
button.setVerticalTextPosition(SwingConstants.BOTTOM);
button.setPreferredSize(new Dimension(28, 28));
return button;
}