Increase gap between button icon and text
This commit is contained in:
parent
779b1c6554
commit
e98f864bb1
@ -69,7 +69,7 @@ import net.sf.openrocket.gui.util.Icons;
|
||||
import net.sf.openrocket.gui.util.OpenFileWorker;
|
||||
import net.sf.openrocket.gui.util.SaveFileWorker;
|
||||
import net.sf.openrocket.gui.util.SwingPreferences;
|
||||
import net.sf.openrocket.gui.widgets.SelectColorButton;
|
||||
import net.sf.openrocket.gui.widgets.IconButton;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.logging.Markers;
|
||||
import net.sf.openrocket.rocketcomponent.AxialStage;
|
||||
@ -412,29 +412,29 @@ public class BasicFrame extends JFrame {
|
||||
|
||||
|
||||
// Buttons
|
||||
JButton button = new SelectColorButton();
|
||||
JButton button = new IconButton();
|
||||
button.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
RocketActions.tieActionToButton(button, actions.getMoveUpAction());
|
||||
panel.add(button, "sizegroup buttons, aligny 65%");
|
||||
|
||||
button = new SelectColorButton();
|
||||
button = new IconButton();
|
||||
button.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
RocketActions.tieActionToButton(button, actions.getMoveDownAction());
|
||||
panel.add(button, "sizegroup buttons, aligny 0%");
|
||||
|
||||
button = new SelectColorButton();
|
||||
button = new IconButton();
|
||||
button.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
RocketActions.tieActionToButton(button, actions.getEditAction());
|
||||
button.setMnemonic(0);
|
||||
panel.add(button, "sizegroup buttons, gaptop 20%");
|
||||
|
||||
button = new SelectColorButton();
|
||||
button = new IconButton();
|
||||
button.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
RocketActions.tieActionToButton(button, actions.getDuplicateAction());
|
||||
button.setMnemonic(0);
|
||||
panel.add(button, "sizegroup buttons");
|
||||
|
||||
button = new SelectColorButton();
|
||||
button = new IconButton();
|
||||
button.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
RocketActions.tieActionToButton(button, actions.getDeleteAction());
|
||||
button.setMnemonic(0);
|
||||
|
@ -25,6 +25,7 @@ import net.sf.openrocket.gui.components.StyledLabel;
|
||||
import net.sf.openrocket.gui.configdialog.ComponentConfigDialog;
|
||||
import net.sf.openrocket.gui.dialogs.ScaleDialog;
|
||||
import net.sf.openrocket.gui.util.Icons;
|
||||
import net.sf.openrocket.gui.widgets.IconButton;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.logging.Markers;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||
|
@ -38,6 +38,7 @@ import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
|
||||
import net.sf.openrocket.gui.widgets.IconButton;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -124,31 +125,31 @@ public class SimulationPanel extends JPanel {
|
||||
//////// The simulation action buttons ////////
|
||||
|
||||
//// New simulation button
|
||||
JButton newButton = new SelectColorButton();
|
||||
JButton newButton = new IconButton();
|
||||
RocketActions.tieActionToButton(newButton, newSimulationAction, trans.get("simpanel.but.newsimulation"));
|
||||
newButton.setToolTipText(trans.get("simpanel.but.ttip.newsimulation"));
|
||||
this.add(newButton, "skip 1, gapright para");
|
||||
|
||||
//// Edit simulation button
|
||||
editButton = new SelectColorButton();
|
||||
editButton = new IconButton();
|
||||
RocketActions.tieActionToButton(editButton, editSimulationAction, trans.get("simpanel.but.editsimulation"));
|
||||
editButton.setToolTipText(trans.get("simpanel.but.ttip.editsim"));
|
||||
this.add(editButton, "gapright para");
|
||||
|
||||
//// Run simulations
|
||||
runButton = new SelectColorButton();
|
||||
runButton = new IconButton();
|
||||
RocketActions.tieActionToButton(runButton, runSimulationAction, trans.get("simpanel.but.runsimulations"));
|
||||
runButton.setToolTipText(trans.get("simpanel.but.ttip.runsimu"));
|
||||
this.add(runButton, "gapright para");
|
||||
|
||||
//// Delete simulations button
|
||||
deleteButton = new SelectColorButton();
|
||||
deleteButton = new IconButton();
|
||||
RocketActions.tieActionToButton(deleteButton, deleteSimulationAction, trans.get("simpanel.but.deletesimulations"));
|
||||
deleteButton.setToolTipText(trans.get("simpanel.but.ttip.deletesim"));
|
||||
this.add(deleteButton, "gapright para");
|
||||
|
||||
//// Plot / export button
|
||||
plotButton = new SelectColorButton();
|
||||
plotButton = new IconButton();
|
||||
RocketActions.tieActionToButton(plotButton, plotSimulationAction, trans.get("simpanel.but.plotexport"));
|
||||
this.add(plotButton, "wrap para");
|
||||
|
||||
|
@ -23,6 +23,7 @@ import net.sf.openrocket.gui.dialogs.flightconfiguration.RenameConfigDialog;
|
||||
import net.sf.openrocket.gui.main.BasicFrame;
|
||||
import net.sf.openrocket.gui.main.RocketActions;
|
||||
import net.sf.openrocket.gui.util.Icons;
|
||||
import net.sf.openrocket.gui.widgets.IconButton;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||
import net.sf.openrocket.rocketcomponent.FlightConfigurableComponent;
|
||||
@ -97,22 +98,22 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
||||
tabs.add(trans.get("edtmotorconfdlg.lbl.Stagetab"), separationConfigurationPanel);
|
||||
|
||||
//// New configuration
|
||||
newConfButton = new SelectColorButton();
|
||||
newConfButton = new IconButton();
|
||||
RocketActions.tieActionToButton(newConfButton, newConfigAction);
|
||||
this.add(newConfButton,"skip 1,gapright para");
|
||||
|
||||
//// Rename configuration
|
||||
renameConfButton = new SelectColorButton();
|
||||
renameConfButton = new IconButton();
|
||||
RocketActions.tieActionToButton(renameConfButton, renameConfigAction);
|
||||
this.add(renameConfButton,"gapright para");
|
||||
|
||||
//// Remove configuration
|
||||
removeConfButton = new SelectColorButton();
|
||||
removeConfButton = new IconButton();
|
||||
RocketActions.tieActionToButton(removeConfButton, removeConfigAction);
|
||||
this.add(removeConfButton,"gapright para");
|
||||
|
||||
//// Duplicate configuration
|
||||
duplicateConfButton = new SelectColorButton();
|
||||
duplicateConfButton = new IconButton();
|
||||
RocketActions.tieActionToButton(duplicateConfButton, duplicateConfigAction);
|
||||
this.add(duplicateConfButton, "wrap");
|
||||
|
||||
|
37
swing/src/net/sf/openrocket/gui/widgets/IconButton.java
Normal file
37
swing/src/net/sf/openrocket/gui/widgets/IconButton.java
Normal file
@ -0,0 +1,37 @@
|
||||
package net.sf.openrocket.gui.widgets;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
|
||||
/**
|
||||
* Button specifically for displaying an icon.
|
||||
*/
|
||||
public class IconButton extends SelectColorButton {
|
||||
private static final int ICON_GAP = 10;
|
||||
public static final double ICON_SCALE = 0.8;
|
||||
|
||||
public IconButton() {
|
||||
setIconTextGap(ICON_GAP);
|
||||
}
|
||||
|
||||
public IconButton(Icon icon) {
|
||||
super(icon);
|
||||
setIconTextGap(ICON_GAP);
|
||||
}
|
||||
|
||||
public IconButton(String text) {
|
||||
super(text);
|
||||
setIconTextGap(ICON_GAP);
|
||||
}
|
||||
|
||||
public IconButton(Action a) {
|
||||
super(a);
|
||||
setIconTextGap(ICON_GAP);
|
||||
}
|
||||
|
||||
public IconButton(String text, Icon icon) {
|
||||
super(text, icon);
|
||||
setIconTextGap(ICON_GAP);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user