mirror of https://github.com/rusefi/RomRaider.git
logger dash panel enhanced with bar tracking
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@441 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
0b5f881f50
commit
19e5eb4227
|
@ -23,6 +23,8 @@ package enginuity.logger.ui.handler.dash;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import static java.awt.BorderLayout.*;
|
import static java.awt.BorderLayout.*;
|
||||||
|
import static java.awt.Color.BLACK;
|
||||||
|
import static java.awt.Color.WHITE;
|
||||||
import static java.awt.Font.BOLD;
|
import static java.awt.Font.BOLD;
|
||||||
import static java.awt.Font.PLAIN;
|
import static java.awt.Font.PLAIN;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -32,10 +34,13 @@ import enginuity.logger.definition.EcuData;
|
||||||
import static enginuity.util.ParamChecker.checkNotNull;
|
import static enginuity.util.ParamChecker.checkNotNull;
|
||||||
|
|
||||||
public final class PlainGauge extends Gauge {
|
public final class PlainGauge extends Gauge {
|
||||||
|
private static final Color RED = new Color(190, 30, 30);
|
||||||
|
private static final Color DARK_GREY = new Color(40, 40, 40);
|
||||||
|
private static final Color LIGHT_GREY = new Color(56, 56, 56);
|
||||||
private static final String BLANK = "";
|
private static final String BLANK = "";
|
||||||
private final String zeroText;
|
private final String zeroText;
|
||||||
private final EcuData ecuData;
|
private final EcuData ecuData;
|
||||||
private final JLabel currentLabel = new JLabel(BLANK, JLabel.CENTER);
|
private final JLabel liveValueLabel = new JLabel(BLANK, JLabel.CENTER);
|
||||||
private final JLabel maxLabel = new JLabel(BLANK, JLabel.CENTER);
|
private final JLabel maxLabel = new JLabel(BLANK, JLabel.CENTER);
|
||||||
private final JLabel minLabel = new JLabel(BLANK, JLabel.CENTER);
|
private final JLabel minLabel = new JLabel(BLANK, JLabel.CENTER);
|
||||||
private final JLabel title = new JLabel(BLANK, JLabel.CENTER);
|
private final JLabel title = new JLabel(BLANK, JLabel.CENTER);
|
||||||
|
@ -59,7 +64,7 @@ public final class PlainGauge extends Gauge {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetValue() {
|
public void resetValue() {
|
||||||
currentLabel.setText(zeroText);
|
liveValueLabel.setText(zeroText);
|
||||||
max = Double.MIN_VALUE;
|
max = Double.MIN_VALUE;
|
||||||
maxLabel.setText(zeroText);
|
maxLabel.setText(zeroText);
|
||||||
min = Double.MAX_VALUE;
|
min = Double.MAX_VALUE;
|
||||||
|
@ -73,26 +78,29 @@ public final class PlainGauge extends Gauge {
|
||||||
refreshTitle();
|
refreshTitle();
|
||||||
resetValue();
|
resetValue();
|
||||||
setPreferredSize(new Dimension(60, 40));
|
setPreferredSize(new Dimension(60, 40));
|
||||||
setBackground(Color.GREEN);
|
setBackground(LIGHT_GREY);
|
||||||
setLayout(new BorderLayout(3, 3));
|
setLayout(new BorderLayout(3, 3));
|
||||||
|
|
||||||
// title
|
// title
|
||||||
title.setFont(getFont().deriveFont(BOLD, 12F));
|
title.setFont(getFont().deriveFont(BOLD, 12F));
|
||||||
|
title.setForeground(WHITE);
|
||||||
add(title, NORTH);
|
add(title, NORTH);
|
||||||
|
|
||||||
// data panel
|
// data panel
|
||||||
JPanel data = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 3));
|
JPanel data = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 3));
|
||||||
data.setBackground(Color.YELLOW);
|
data.setBackground(BLACK);
|
||||||
data.setBorder(new BevelBorder(LOWERED));
|
data.setBorder(new BevelBorder(LOWERED));
|
||||||
currentLabel.setFont(getFont().deriveFont(PLAIN, 40F));
|
liveValueLabel.setFont(getFont().deriveFont(PLAIN, 40F));
|
||||||
JPanel currentPanel = new JPanel(new BorderLayout());
|
liveValueLabel.setForeground(WHITE);
|
||||||
currentPanel.setPreferredSize(new Dimension(140, 80));
|
JPanel liveValuePanel = new JPanel(new BorderLayout());
|
||||||
currentPanel.add(currentLabel, CENTER);
|
liveValuePanel.setBackground(LIGHT_GREY);
|
||||||
data.add(currentPanel);
|
liveValuePanel.setPreferredSize(new Dimension(140, 80));
|
||||||
|
liveValuePanel.add(liveValueLabel, CENTER);
|
||||||
|
data.add(liveValuePanel);
|
||||||
|
|
||||||
// max/min panel
|
// max/min panel
|
||||||
JPanel maxMinPanel = new JPanel(new BorderLayout(2, 2));
|
JPanel maxMinPanel = new JPanel(new BorderLayout(2, 2));
|
||||||
maxMinPanel.setBackground(Color.YELLOW);
|
maxMinPanel.setBackground(BLACK);
|
||||||
JPanel maxPanel = buildMaxMinPanel("max", maxLabel);
|
JPanel maxPanel = buildMaxMinPanel("max", maxLabel);
|
||||||
JPanel minPanel = buildMaxMinPanel("min", minLabel);
|
JPanel minPanel = buildMaxMinPanel("min", minLabel);
|
||||||
maxMinPanel.add(maxPanel, NORTH);
|
maxMinPanel.add(maxPanel, NORTH);
|
||||||
|
@ -103,19 +111,23 @@ public final class PlainGauge extends Gauge {
|
||||||
progressBar.setStringPainted(false);
|
progressBar.setStringPainted(false);
|
||||||
progressBar.setIndeterminate(false);
|
progressBar.setIndeterminate(false);
|
||||||
progressBar.setPreferredSize(new Dimension(20, 82));
|
progressBar.setPreferredSize(new Dimension(20, 82));
|
||||||
|
progressBar.setBackground(WHITE);
|
||||||
|
progressBar.setForeground(RED);
|
||||||
data.add(progressBar);
|
data.add(progressBar);
|
||||||
add(data, CENTER);
|
add(data, CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel buildMaxMinPanel(String title, JLabel label) {
|
private JPanel buildMaxMinPanel(String title, JLabel label) {
|
||||||
label.setFont(getFont().deriveFont(PLAIN, 12F));
|
label.setFont(getFont().deriveFont(PLAIN, 12F));
|
||||||
|
label.setForeground(WHITE);
|
||||||
JPanel panel = new JPanel(new BorderLayout(1, 1));
|
JPanel panel = new JPanel(new BorderLayout(1, 1));
|
||||||
panel.setPreferredSize(new Dimension(60, 38));
|
panel.setPreferredSize(new Dimension(60, 38));
|
||||||
panel.setBackground(Color.CYAN);
|
panel.setBackground(LIGHT_GREY);
|
||||||
JLabel titleLabel = new JLabel(title, JLabel.CENTER);
|
JLabel titleLabel = new JLabel(title, JLabel.CENTER);
|
||||||
titleLabel.setFont(getFont().deriveFont(BOLD, 12F));
|
titleLabel.setFont(getFont().deriveFont(BOLD, 12F));
|
||||||
|
titleLabel.setForeground(WHITE);
|
||||||
JPanel dataPanel = new JPanel(new BorderLayout());
|
JPanel dataPanel = new JPanel(new BorderLayout());
|
||||||
dataPanel.setBackground(Color.PINK);
|
dataPanel.setBackground(DARK_GREY);
|
||||||
dataPanel.add(label, CENTER);
|
dataPanel.add(label, CENTER);
|
||||||
panel.add(titleLabel, NORTH);
|
panel.add(titleLabel, NORTH);
|
||||||
panel.add(dataPanel, CENTER);
|
panel.add(dataPanel, CENTER);
|
||||||
|
@ -135,7 +147,7 @@ public final class PlainGauge extends Gauge {
|
||||||
minLabel.setText(text);
|
minLabel.setText(text);
|
||||||
progressBar.setMinimum(scaledValue);
|
progressBar.setMinimum(scaledValue);
|
||||||
}
|
}
|
||||||
currentLabel.setText(text);
|
liveValueLabel.setText(text);
|
||||||
progressBar.setValue(scaledValue);
|
progressBar.setValue(scaledValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
|
|
||||||
package enginuity.swing;
|
package enginuity.swing;
|
||||||
|
|
||||||
import javax.swing.JDialog;
|
import javax.swing.*;
|
||||||
import javax.swing.JFrame;
|
|
||||||
import static javax.swing.UIManager.getSystemLookAndFeelClassName;
|
import static javax.swing.UIManager.getSystemLookAndFeelClassName;
|
||||||
import static javax.swing.UIManager.setLookAndFeel;
|
import static javax.swing.UIManager.setLookAndFeel;
|
||||||
|
|
||||||
|
@ -43,6 +42,7 @@ public final class LookAndFeelManager {
|
||||||
System.setProperty("apple.awt.rendering", "true");
|
System.setProperty("apple.awt.rendering", "true");
|
||||||
System.setProperty("apple.awt.window.position.forceSafeCreation", "true");
|
System.setProperty("apple.awt.window.position.forceSafeCreation", "true");
|
||||||
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Enginuity");
|
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Enginuity");
|
||||||
|
System.setProperty("apple.awt.brushMetalLook", "true");
|
||||||
// setRestrictedPlatformLookAndFeel("Windows", "5.1");
|
// setRestrictedPlatformLookAndFeel("Windows", "5.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue