auto-sync
This commit is contained in:
parent
783b98d3f1
commit
e725aaa34e
|
@ -35,7 +35,7 @@ public class AverageAnglePanel {
|
|||
}
|
||||
}, BorderLayout.CENTER);
|
||||
|
||||
AnalogChartCentral.addListener(new AnalogChartCentral.AnalogChartListener() {
|
||||
SensorSnifferCentral.addListener(new SensorSnifferCentral.AnalogChartListener() {
|
||||
@Override
|
||||
public void onAnalogChart(String message) {
|
||||
int rpm = (int) SensorCentral.getInstance().getValue(Sensor.RPM);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class Launcher {
|
|||
public static int defaultFontSize;
|
||||
|
||||
private static Frame staticFrame;
|
||||
TableEditor tableEditor = new TableEditor();
|
||||
private final TableEditorPane tableEditor = new TableEditorPane();
|
||||
|
||||
FrameHelper frame = new FrameHelper() {
|
||||
@Override
|
||||
|
@ -68,25 +68,24 @@ public class Launcher {
|
|||
this.port = port;
|
||||
staticFrame = frame.getFrame();
|
||||
FileLog.MAIN.start();
|
||||
FileLog.MAIN.logLine("Console " + CONSOLE_VERSION);
|
||||
|
||||
getConfig().getRoot().setProperty(PORT_KEY, port);
|
||||
|
||||
LinkManager.start(port);
|
||||
|
||||
FileLog.MAIN.logLine("Console " + CONSOLE_VERSION);
|
||||
|
||||
|
||||
EngineSnifferPanel engineSnifferPanel = new EngineSnifferPanel(getConfig().getRoot().getChild("digital_sniffer"));
|
||||
if (LinkManager.isLogViewerMode(port))
|
||||
tabbedPane.add("Log Viewer", new LogViewer(engineSnifferPanel));
|
||||
|
||||
ConnectionWatchdog.start();
|
||||
|
||||
RpmPanel mainGauges = new RpmPanel(getConfig().getRoot().getChild("main_gauges"));
|
||||
tabbedPane.addTab("Main", mainGauges.createRpmPanel());
|
||||
tabbedPane.addTab("Gauges", new GaugesPanel().getContent());
|
||||
tabbedPane.addTab("Engine Sniffer", engineSnifferPanel.getPanel());
|
||||
tabbedPane.addTab("Sensor Sniffer", new AnalogChartPanel().getPanel());
|
||||
tabbedPane.addTab("Sensor Sniffer", new SensorSnifferPane().getPanel());
|
||||
|
||||
tabbedPane.addTab("Table Editor", tableEditor);
|
||||
|
||||
// tabbedPane.addTab("LE controls", new FlexibleControls().getPanel());
|
||||
|
||||
|
@ -98,6 +97,7 @@ public class Launcher {
|
|||
}
|
||||
// tabbedPane.addTab("live map adjustment", new Live3DReport().getControl());
|
||||
tabbedPane.add("Messages", new MessagesPane(getConfig().getRoot().getChild("messages")).getContent());
|
||||
tabbedPane.addTab("Table Editor", tableEditor);
|
||||
// tabbedPane.add("Wizards", new Wizard().createPane());
|
||||
|
||||
tabbedPane.add("Settings", new SettingsTab().createPane());
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.rusefi.io.LinkManager;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class AnalogChartCentral {
|
||||
public class SensorSnifferCentral {
|
||||
|
||||
private static List<AnalogChartListener> listeners = new CopyOnWriteArrayList<>();
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.config.Fields;
|
||||
import com.rusefi.ui.RpmLabel;
|
||||
import com.rusefi.ui.RpmModel;
|
||||
import com.rusefi.ui.config.EnumConfigField;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
|
@ -23,7 +24,7 @@ import static com.rusefi.ui.util.LocalizedMessages.RESUME;
|
|||
* Date: 12/21/13
|
||||
* Andrey Belomutskiy (c) 2012-2013
|
||||
*/
|
||||
public class AnalogChartPanel {
|
||||
public class SensorSnifferPane {
|
||||
private static final String HELP_URL = "http://rusefi.com/wiki/index.php?title=Manual:DevConsole#Analog_Chart";
|
||||
|
||||
private final TreeMap<Double, Double> values = new TreeMap<>();
|
||||
|
@ -38,9 +39,8 @@ public class AnalogChartPanel {
|
|||
|
||||
private boolean paused = false;
|
||||
|
||||
public AnalogChartPanel() {
|
||||
|
||||
AnalogChartCentral.addListener(new AnalogChartCentral.AnalogChartListener() {
|
||||
public SensorSnifferPane() {
|
||||
SensorSnifferCentral.addListener(new SensorSnifferCentral.AnalogChartListener() {
|
||||
@Override
|
||||
public void onAnalogChart(final String message) {
|
||||
// this callback is invoked from the connectivity thread, need to handle in AWT for thread-safety
|
||||
|
@ -57,7 +57,7 @@ public class AnalogChartPanel {
|
|||
}
|
||||
});
|
||||
|
||||
final JPanel upperPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
|
||||
final JPanel upperPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
|
||||
JButton clearButton = new JButton(CLEAR.getMessage());
|
||||
clearButton.setMnemonic('c');
|
||||
|
@ -70,10 +70,9 @@ public class AnalogChartPanel {
|
|||
});
|
||||
upperPanel.add(clearButton);
|
||||
|
||||
JButton imageButton = new JButton(EngineSnifferPanel.SAVE_IMAGE);
|
||||
imageButton.setMnemonic('s');
|
||||
upperPanel.add(imageButton);
|
||||
imageButton.addActionListener(new ActionListener() {
|
||||
JButton saveImageButton = UiUtils.createSaveImageButton();
|
||||
upperPanel.add(saveImageButton);
|
||||
saveImageButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int rpm = RpmModel.getInstance().getValue();
|
||||
|
@ -86,6 +85,7 @@ public class AnalogChartPanel {
|
|||
|
||||
final JButton pauseButton = new JButton(PAUSE.getMessage());
|
||||
upperPanel.add(pauseButton);
|
||||
upperPanel.add(new RpmLabel(2).getContent());
|
||||
|
||||
upperPanel.add(new URLLabel(EngineSnifferPanel.HELP_TEXT, HELP_URL));
|
||||
pauseButton.addActionListener(new
|
||||
|
@ -98,13 +98,13 @@ public class AnalogChartPanel {
|
|||
}
|
||||
);
|
||||
|
||||
upperPanel.setBorder(BorderFactory.createLineBorder(Color.white));
|
||||
// upperPanel.setBorder(BorderFactory.createLineBorder(Color.orange));
|
||||
content.add(upperPanel, BorderLayout.NORTH);
|
||||
|
||||
content.add(canvas, BorderLayout.CENTER);
|
||||
|
||||
final JPanel lowerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
|
||||
lowerPanel.setBorder(BorderFactory.createLineBorder(Color.white));
|
||||
lowerPanel.setBorder(BorderFactory.createLineBorder(Color.cyan));
|
||||
content.add(lowerPanel, BorderLayout.SOUTH);
|
||||
|
||||
lowerPanel.add(new EnumConfigField(Fields.SENSOR_SNIFFER_MODE, "Mode", "Off", "Trigger", "MAP").getContent());
|
|
@ -11,9 +11,9 @@ import java.awt.*;
|
|||
|
||||
import static com.romraider.editor.ecu.ECUEditorManager.getECUEditor;
|
||||
|
||||
public class TableEditor extends JPanel {
|
||||
public class TableEditorPane extends JPanel {
|
||||
|
||||
public TableEditor() {
|
||||
public TableEditorPane() {
|
||||
super(new BorderLayout());
|
||||
add(new JLabel("Loading tables"), BorderLayout.CENTER);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.test;
|
||||
|
||||
import com.rusefi.AnalogChartPanel;
|
||||
import com.rusefi.SensorSnifferPane;
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,6 @@ import com.rusefi.ui.util.FrameHelper;
|
|||
|
||||
public class AnalogChartPanelSandbox extends FrameHelper {
|
||||
public static void main(String[] args) {
|
||||
new EcuStimulatorSandbox().showFrame(new AnalogChartPanel().getPanel());
|
||||
new EcuStimulatorSandbox().showFrame(new SensorSnifferPane().getPanel());
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package com.rusefi.ui;
|
|||
import com.rusefi.FileLog;
|
||||
import com.rusefi.models.Range;
|
||||
import com.rusefi.models.XYData;
|
||||
import com.rusefi.ui.engine.EngineSnifferPanel;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import com.rusefi.ui.util.JTextFieldWithWidth;
|
||||
import net.ericaro.surfaceplotter.DefaultSurfaceModel;
|
||||
|
@ -37,8 +36,7 @@ public class ChartHelper {
|
|||
jsp.getSurface().setYLabel("MAF voltage");
|
||||
result.add(BorderLayout.CENTER, jsp);
|
||||
|
||||
JButton saveImageButton = new JButton(EngineSnifferPanel.SAVE_IMAGE);
|
||||
saveImageButton.setMnemonic('s');
|
||||
JButton saveImageButton = UiUtils.createSaveImageButton();
|
||||
saveImageButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.rusefi.ui;
|
|||
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import com.rusefi.ui.widgets.RpmCommand;
|
||||
import com.rusefi.ui.widgets.SensorGauge;
|
||||
|
||||
|
@ -23,6 +24,12 @@ public class GaugesPanel {
|
|||
public GaugesPanel() {
|
||||
// Radial radial2 = createRadial("title");
|
||||
|
||||
|
||||
JButton saveImageButton = UiUtils.createSaveImageButton();
|
||||
|
||||
JPanel upperPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
upperPanel.add(saveImageButton);
|
||||
|
||||
JPanel box2 = new JPanel(new GridLayout(3, 5));
|
||||
|
||||
box2.add(createControls());
|
||||
|
@ -68,8 +75,8 @@ public class GaugesPanel {
|
|||
|
||||
box2.add(SensorGauge.createGauge(Sensor.TIMING));
|
||||
|
||||
|
||||
//add(rpmGauge);
|
||||
content.add(upperPanel, BorderLayout.NORTH);
|
||||
content.add(box2, BorderLayout.CENTER);
|
||||
content.add(new WarningPanel().getPanel(), BorderLayout.SOUTH);
|
||||
// add(new JLabel("fd"), BorderLayout.EAST);
|
||||
|
|
|
@ -25,20 +25,19 @@ public class MessagesPane {
|
|||
private final JButton fontButton = new JButton("Font");
|
||||
|
||||
public MessagesPane(final Node config) {
|
||||
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
|
||||
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
|
||||
final MessagesPanel messagesPanel = new MessagesPanel(config, true);
|
||||
messagesPanel.loadFont(config);
|
||||
content.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||
final MessagesPanel upperPanel = new MessagesPanel(config, true);
|
||||
upperPanel.loadFont(config);
|
||||
|
||||
JPanel middlePanel = new JPanel(new BorderLayout());
|
||||
middlePanel.add(messagesPanel.getMessagesScroll(), BorderLayout.CENTER);
|
||||
middlePanel.add(upperPanel.getMessagesScroll(), BorderLayout.CENTER);
|
||||
middlePanel.add(new RecentCommands().getContent(), BorderLayout.EAST);
|
||||
|
||||
content.add(middlePanel, BorderLayout.CENTER);
|
||||
|
||||
messagesPanel.getButtonPanel().add(new RpmLabel().getContent());
|
||||
topPanel.add(messagesPanel.getButtonPanel());
|
||||
upperPanel.getButtonPanel().add(new RpmLabel(2).getContent());
|
||||
topPanel.add(upperPanel.getButtonPanel());
|
||||
topPanel.add(fontButton);
|
||||
topPanel.add(new URLLabel(EngineSnifferPanel.HELP_TEXT, HELP_URL));
|
||||
content.add(topPanel, BorderLayout.NORTH);
|
||||
|
@ -51,14 +50,13 @@ public class MessagesPane {
|
|||
|
||||
content.add(statsPanel, BorderLayout.SOUTH);
|
||||
|
||||
|
||||
fontButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JFontChooser fc = new JFontChooser(Launcher.getFrame());
|
||||
fc.setLocationRelativeTo(fontButton);
|
||||
if (fc.showDialog(messagesPanel.getFont()) == JFontChooser.OK_OPTION) {
|
||||
messagesPanel.setFont(fc.getFont(), config);
|
||||
if (fc.showDialog(upperPanel.getFont()) == JFontChooser.OK_OPTION) {
|
||||
upperPanel.setFont(fc.getFont(), config);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MessagesPanel {
|
|||
public MessagesPanel(Node config, boolean listenToCommands) {
|
||||
JPanel middlePanel = new JPanel(new BorderLayout());
|
||||
middlePanel.add(messagesScroll, BorderLayout.CENTER);
|
||||
buttonPanel.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||
// buttonPanel.setBorder(BorderFactory.createLineBorder(Color.cyan));
|
||||
|
||||
StyledDocument d = (StyledDocument) messages.getDocument();
|
||||
bold = d.addStyle("StyleName", null);
|
||||
|
|
|
@ -17,7 +17,10 @@ public class RpmLabel {
|
|||
private final JLabel rpmCaption = new JLabel("RPM:");
|
||||
|
||||
public RpmLabel() {
|
||||
rpmCaption.setBorder(BorderFactory.createLineBorder(Color.white));
|
||||
this(1);
|
||||
}
|
||||
|
||||
public RpmLabel(int size) {
|
||||
rpmValue.setForeground(Color.red);
|
||||
|
||||
content.setBorder(BorderFactory.createLineBorder(Color.white));
|
||||
|
@ -45,6 +48,7 @@ public class RpmLabel {
|
|||
}
|
||||
}
|
||||
});
|
||||
setSize(size);
|
||||
}
|
||||
|
||||
public JPanel getContent() {
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.awt.*;
|
|||
*/
|
||||
public class RpmPanel {
|
||||
private final Node config;
|
||||
private RpmLabel rpmLabel = new RpmLabel();
|
||||
private RpmLabel rpmLabel = new RpmLabel(15);
|
||||
// that's for CKP signal emulation
|
||||
public final WaveInfoPanel wave0 = new WaveInfoPanel(0);
|
||||
public final WaveInfoPanel wave1 = new WaveInfoPanel(1);
|
||||
|
@ -23,11 +23,10 @@ public class RpmPanel {
|
|||
|
||||
public RpmPanel(Node config) {
|
||||
this.config = config;
|
||||
rpmLabel.setSize(15);
|
||||
}
|
||||
|
||||
public JComponent createRpmPanel() {
|
||||
JPanel controls = createControls();
|
||||
// JPanel leftSideControls = createControls();
|
||||
|
||||
JPanel gauges = new JPanel(new GridLayout(2, 3));
|
||||
gauges.setBorder(BorderFactory.createLineBorder(Color.black));
|
||||
|
@ -39,29 +38,26 @@ public class RpmPanel {
|
|||
gauges.add(SensorGauge.createGauge(Sensor.MAF));
|
||||
gauges.add(SensorGauge.createGauge(Sensor.TPS));
|
||||
|
||||
ConnectionWatchdog.start();
|
||||
|
||||
JPanel smallMessagePanel = new JPanel(new BorderLayout());
|
||||
MessagesPanel mp = new MessagesPanel(config, false);
|
||||
smallMessagePanel.add(BorderLayout.NORTH, mp.getButtonPanel());
|
||||
smallMessagePanel.add(BorderLayout.CENTER, mp.getMessagesScroll());
|
||||
|
||||
JPanel msgPanel = new JPanel(new BorderLayout());
|
||||
msgPanel.add(new AnyCommand(config, false).getContent(), BorderLayout.NORTH);
|
||||
msgPanel.add(smallMessagePanel, BorderLayout.CENTER);
|
||||
|
||||
JComponent rpmPanel = new JPanel(new BorderLayout());
|
||||
rpmPanel.setBorder(BorderFactory.createLineBorder(Color.white));
|
||||
|
||||
rpmPanel.add(rpmLabel.getContent(), BorderLayout.NORTH);
|
||||
rpmPanel.add(controls, BorderLayout.WEST);
|
||||
// rpmPanel.add(leftSideControls, BorderLayout.WEST);
|
||||
rpmPanel.add(gauges, BorderLayout.CENTER);
|
||||
rpmPanel.add(msgPanel, BorderLayout.EAST);
|
||||
rpmPanel.add(new WarningPanel().getPanel(), BorderLayout.SOUTH);
|
||||
|
||||
return rpmPanel;
|
||||
}
|
||||
|
||||
/*
|
||||
private JPanel createControls() {
|
||||
JPanel controls = new JPanel(new MigLayout());
|
||||
controls.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||
|
@ -85,5 +81,6 @@ public class RpmPanel {
|
|||
|
||||
return controls;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ public class EngineSnifferPanel {
|
|||
public static final Comparator<String> INSTANCE = new NameUtil.ImageOrderComparator();
|
||||
private static final String HELP_URL = "http://rusefi.com/wiki/index.php?title=Manual:DevConsole#Digital_Chart";
|
||||
public static final String HELP_TEXT = "Click here for online help";
|
||||
public static final String SAVE_IMAGE = "save image";
|
||||
|
||||
private final JPanel chartPanel = new JPanel(new BorderLayout());
|
||||
private final JPanel panel = new JPanel(new BorderLayout());
|
||||
|
@ -64,12 +63,12 @@ public class EngineSnifferPanel {
|
|||
}
|
||||
};
|
||||
|
||||
JScrollPane pane = new JScrollPane(imagePanel, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||
private final JScrollPane pane = new JScrollPane(imagePanel, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||
|
||||
private final ZoomControl zoomControl = new ZoomControl();
|
||||
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
|
||||
private final UpDownImage crank = createImage(NameUtil.CRANK1);
|
||||
private ChartScrollControl scrollControl;
|
||||
private final ChartScrollControl scrollControl;
|
||||
|
||||
private boolean isPaused;
|
||||
|
||||
|
@ -101,8 +100,7 @@ public class EngineSnifferPanel {
|
|||
}
|
||||
});
|
||||
|
||||
JButton saveImageButton = new JButton(SAVE_IMAGE);
|
||||
saveImageButton.setMnemonic('s');
|
||||
JButton saveImageButton = UiUtils.createSaveImageButton();
|
||||
saveImageButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -120,16 +118,16 @@ public class EngineSnifferPanel {
|
|||
}
|
||||
});
|
||||
|
||||
JPanel topButtons = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
topButtons.add(clearButton);
|
||||
topButtons.add(saveImageButton);
|
||||
topButtons.add(pauseButton);
|
||||
topButtons.add(new RpmLabel().setSize(2).getContent());
|
||||
JPanel upperPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
upperPanel.add(clearButton);
|
||||
upperPanel.add(saveImageButton);
|
||||
upperPanel.add(pauseButton);
|
||||
upperPanel.add(new RpmLabel(2).getContent());
|
||||
|
||||
JComponent command = new AnyCommand(config, "chartsize " + EFI_DEFAULT_CHART_SIZE, true).getContent();
|
||||
topButtons.add(command);
|
||||
upperPanel.add(command);
|
||||
|
||||
topButtons.add(zoomControl);
|
||||
upperPanel.add(zoomControl);
|
||||
|
||||
scrollControl = ChartRepository.getInstance().createControls(new ChartRepository.ChartRepositoryListener() {
|
||||
@Override
|
||||
|
@ -137,9 +135,10 @@ public class EngineSnifferPanel {
|
|||
displayChart(chart);
|
||||
}
|
||||
});
|
||||
topButtons.add(scrollControl.getContent());
|
||||
if (LinkManager.isLogViewer())
|
||||
upperPanel.add(scrollControl.getContent());
|
||||
|
||||
topButtons.add(new URLLabel(HELP_TEXT, HELP_URL));
|
||||
upperPanel.add(new URLLabel(HELP_TEXT, HELP_URL));
|
||||
|
||||
JPanel lowerButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0));
|
||||
lowerButtons.add(new BitConfigField(Fields.isDigitalChartEnabled, "Collect Engine Data").getContent());
|
||||
|
@ -149,7 +148,7 @@ public class EngineSnifferPanel {
|
|||
bottomPanel.add(lowerButtons, BorderLayout.NORTH);
|
||||
bottomPanel.add(statusPanel.infoPanel, BorderLayout.SOUTH);
|
||||
|
||||
chartPanel.add(topButtons, BorderLayout.NORTH);
|
||||
chartPanel.add(upperPanel, BorderLayout.NORTH);
|
||||
chartPanel.add(pane, BorderLayout.CENTER);
|
||||
chartPanel.add(bottomPanel, BorderLayout.SOUTH);
|
||||
|
||||
|
|
|
@ -14,9 +14,10 @@ import java.awt.event.KeyEvent;
|
|||
* (c) Andrey Belomutskiy
|
||||
*/
|
||||
class ZoomControl extends JPanel {
|
||||
private final JLabel currentValue = new JLabel();
|
||||
// private final JLabel currentValue = new JLabel();
|
||||
private double value;
|
||||
public ZoomControlListener listener = null;
|
||||
private final JButton resetZoom = new JButton("*");
|
||||
|
||||
ZoomProvider zoomProvider = new ZoomProvider() {
|
||||
@Override
|
||||
|
@ -41,7 +42,7 @@ class ZoomControl extends JPanel {
|
|||
// }
|
||||
// };
|
||||
|
||||
add(currentValue);
|
||||
// add(currentValue);
|
||||
|
||||
JButton plus = new JButton("+");
|
||||
plus.setMnemonic('z');
|
||||
|
@ -54,7 +55,6 @@ class ZoomControl extends JPanel {
|
|||
plus.setToolTipText("Zoom in");
|
||||
add(plus);
|
||||
|
||||
JButton resetZoom = new JButton("*");
|
||||
resetZoom.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -107,7 +107,8 @@ class ZoomControl extends JPanel {
|
|||
|
||||
private void setValue(double value) {
|
||||
this.value = value;
|
||||
currentValue.setText(String.format(" %.4fms", value));
|
||||
//currentValue.setText(String.format(" %.4fms", value));
|
||||
resetZoom.setEnabled(Math.abs(1 - value) > 0.01);
|
||||
if (listener != null)
|
||||
listener.onZoomChange();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ import static com.rusefi.ui.util.LocalizedMessages.RESUME;
|
|||
* (c) Andrey Belomutskiy
|
||||
*/
|
||||
public class UiUtils {
|
||||
private static final String SAVE_IMAGE = "save image";
|
||||
|
||||
public static void saveImageWithPrompt(String fileName, Component parent, Component component) {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
FileFilter filter = new FileNameExtensionFilter("PNG files", "png");
|
||||
|
@ -95,4 +97,10 @@ public class UiUtils {
|
|||
result.add(component);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static JButton createSaveImageButton() {
|
||||
JButton imageButton = new JButton(SAVE_IMAGE);
|
||||
imageButton.setMnemonic('s');
|
||||
return imageButton;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue