update LayersLegend for dark look and feel

This commit is contained in:
wyq 2020-04-04 17:22:31 +08:00
parent 5dac09f087
commit 98eceff7a6
23 changed files with 47 additions and 42 deletions

View File

@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.formdev:flatlaf:0.27">
<library name="Maven: com.formdev:flatlaf:0.29">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/0.27/flatlaf-0.27.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/0.29/flatlaf-0.29.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/0.27/flatlaf-0.27-javadoc.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/0.29/flatlaf-0.29-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/0.27/flatlaf-0.27-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/formdev/flatlaf/0.29/flatlaf-0.29-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -146,6 +146,6 @@
<orderEntry type="library" name="Maven: de.sciss:docking-frames-core:2.0.0" level="project" />
<orderEntry type="library" name="Maven: com.fifesoft:autocomplete:2.6.0" level="project" />
<orderEntry type="library" name="Maven: com.fifesoft:rsyntaxtextarea:3.0.4" level="project" />
<orderEntry type="library" name="Maven: com.formdev:flatlaf:0.27" level="project" />
<orderEntry type="library" name="Maven: com.formdev:flatlaf:0.29" level="project" />
</component>
</module>

View File

@ -21,12 +21,10 @@
<OpenedFiles>
<OpenedFile File="D:\Run\emips\run_merge\test_read_ctl.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot_cuace_3d_particles_relief.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\dataframe\dataframe_read_table_1.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\Run\emips\run_merge\test_read_ctl.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot_cuace_3d_particles_relief.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\dataframe\dataframe_read_table_1.py"/>
</RecentFiles>
</File>
<Font>
@ -34,5 +32,5 @@
</Font>
<LookFeel Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,-7" MainFormSize="1293,693"/>
<Startup MainFormLocation="-7,0" MainFormSize="1372,792"/>
</MeteoInfo>

View File

@ -37,7 +37,7 @@
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>0.27</version>
<version>0.29</version>
</dependency>
</dependencies>
<properties>

View File

@ -181,7 +181,7 @@ public class ChartPanel extends JPanel implements IChartPanel{
@Override
public void actionPerformed(ActionEvent e) {
LocalDateTime now = LocalDateTime.now();
if (Duration.between(now, lastMouseWheelTime).toMillis() > 200) {
if (Duration.between(lastMouseWheelTime, now).toMillis() > 200) {
xShift = 0;
yShift = 0;
paintScale = 1.0;

View File

@ -1034,15 +1034,17 @@ public class FrmLayerProperty extends javax.swing.JDialog {
}//GEN-LAST:event_jButton_ChartLabelActionPerformed
private void setFieldByLegendType(LegendType aLT) {
this.setFieldByLegendType(aLT, !this._isLoading);
}
private void setFieldByLegendType(LegendType aLT, boolean createLegend) {
if (_mapLayer.getLayerType() == LayerTypes.VectorLayer) {
VectorLayer aLayer = (VectorLayer) _mapLayer;
switch (aLT) {
case SingleSymbol:
this.jComboBox_Field.setEnabled(false);
this.jComboBox_Field.removeAllItems();
if (!this._isLoading) {
this._ifCreateLegendScheme = true;
}
this._ifCreateLegendScheme = createLegend;
createLegendScheme(aLT, "");
this._ifCreateLegendScheme = false;
break;
@ -1272,6 +1274,9 @@ public class FrmLayerProperty extends javax.swing.JDialog {
update();
this._ifCreateLegendScheme = true;
this._isLoading = false;
if (this.jComboBox_LegendType.isEnabled() && this._legendScheme != null)
this.setFieldByLegendType((LegendType)this.jComboBox_LegendType.getSelectedItem(), false);
}
/**

View File

@ -113,7 +113,7 @@ public class LayersLegend extends JPanel {
private JScrollBar _vScrollBar;
private MapLayout _mapLayout;
private ItemNode _selectedNode;
private Color _selectedBackColor = new Color(230, 230, 230);
private Color _selectedBackColor = new Color(75,110,175);
private Color _selectedForeColor = Color.white;
private Point _mouseDownPos = new Point(0, 0);
private ItemNode _dragNode = null;
@ -158,16 +158,16 @@ public class LayersLegend extends JPanel {
}
});
this.setBackground(Color.white);
this.setFont(new Font("宋体", Font.PLAIN, 12));
//this.setBackground(Color.white);
//this.setFont(new Font("宋体", Font.PLAIN, 12));
MapFrame mf = new MapFrame();
mf.setActive(true);
this.addMapFrame(mf);
_mapLayout = null;
frmLayerProp = null;
this.setBackground(Color.white);
this.setForeground(Color.black);
//this.setBackground(Color.white);
//this.setForeground(Color.black);
}
private void initComponents() {
@ -1512,11 +1512,11 @@ public class LayersLegend extends JPanel {
private void drawMapFrame(Graphics2D g, MapFrame aMapFrame, Point sP) {
if (aMapFrame.isSelected()) {
Rectangle rect = new Rectangle(3, sP.y, this.getWidth() - 10, aMapFrame.getHeight());
Rectangle rect = new Rectangle(0, sP.y, this.getWidth(), aMapFrame.getHeight());
g.setColor(_selectedBackColor);
g.fill(rect);
g.setColor(Color.lightGray);
g.draw(rect);
//g.setColor(Color.lightGray);
//g.draw(rect);
}
g.setColor(this.getForeground());
@ -1574,11 +1574,11 @@ public class LayersLegend extends JPanel {
private void drawGroupNode(Graphics2D g, GroupNode groupNode, Point sP) {
//Draw group
if (groupNode.isSelected()) {
Rectangle rect = new Rectangle(3, sP.y, this.getWidth() - 10, groupNode.getHeight());
Rectangle rect = new Rectangle(0, sP.y, this.getWidth(), groupNode.getHeight());
g.setColor(_selectedBackColor);
g.fill(rect);
g.setColor(Color.lightGray);
g.draw(rect);
//g.setColor(Color.lightGray);
//g.draw(rect);
}
g.setColor(this.getForeground());
@ -1611,19 +1611,20 @@ public class LayersLegend extends JPanel {
//Draw Layer
g.setColor(this.getForeground());
if (layerNode.isSelected()) {
Rectangle rect = new Rectangle(3, sP.y, this.getWidth() - 10, layerNode.getHeight());
Rectangle rect = new Rectangle(0, sP.y, this.getWidth(), layerNode.getHeight());
g.setColor(_selectedBackColor);
g.fill(rect);
g.setColor(Color.lightGray);
g.draw(rect);
//g.setColor(Color.lightGray);
//g.draw(rect);
}
if (layerNode.isEditing()) {
Rectangle rect = new Rectangle(3, sP.y, this.getWidth() - 10, layerNode.getHeight());
Rectangle rect = new Rectangle(0, sP.y, this.getWidth(), layerNode.getHeight());
g.setColor(Color.red);
g.draw(rect);
}
g.setColor(this.getForeground());
if (layerNode.getLegendNodes().size() > 0) {
drawExpansionBox(g, new Point(sP.x, sP.y + Constants.EXPAND_BOX_TOP_PAD), layerNode.isExpanded());
}
@ -1727,7 +1728,7 @@ public class LayersLegend extends JPanel {
int y = rect.y + rect.height * 3 / 4;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g.setFont(this.getFont());
g.setColor(Color.black);
g.setColor(this.getForeground());
g.drawString(caption, x, y);
}
@ -1735,7 +1736,7 @@ public class LayersLegend extends JPanel {
int size = 8;
int gap = 2;
Rectangle rect = new Rectangle(sP.x, sP.y, size, size);
g.setColor(Color.gray);
//g.setColor(Color.gray);
g.draw(rect);
GeneralPath path = new GeneralPath();
@ -1746,19 +1747,20 @@ public class LayersLegend extends JPanel {
path.lineTo(sP.x + size / 2, sP.y + size - gap);
}
g.setColor(Color.black);
//g.setColor(Color.black);
g.draw(path);
}
private void drawCheckBox(Graphics2D g, Point sP, int checkStatus) {
int size = 10;
Rectangle rect = new Rectangle(sP.x, sP.y, size, size);
g.setColor(Color.gray);
//g.setColor(Color.gray);
g.draw(rect);
if (checkStatus == 2) {
g.setColor(Color.lightGray);
g.fill(rect);
g.setColor(this.getForeground());
}
switch (checkStatus) {
@ -1769,7 +1771,7 @@ public class LayersLegend extends JPanel {
path.lineTo(sP.x + 5, sP.y + 8);
path.moveTo(sP.x + 5, sP.y + 8);
path.lineTo(sP.x + 8, sP.y + 2);
g.setColor(Color.black);
//g.setColor(Color.black);
g.draw(path);
break;
}

View File

@ -139,6 +139,6 @@
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.19" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.19" level="project" />
<orderEntry type="library" name="Maven: com.fifesoft:rsyntaxtextarea:3.0.4" level="project" />
<orderEntry type="library" name="Maven: com.formdev:flatlaf:0.27" level="project" />
<orderEntry type="library" name="Maven: com.formdev:flatlaf:0.29" level="project" />
</component>
</module>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="config.xml" Type="configurefile">
<Path OpenPath="D:\Temp\HYSPLIT"/>
<Path OpenPath="D:\Temp\micaps"/>
<Font>
<TextFont FontName="宋体" FontSize="15"/>
<TextFont FontName="Arial" FontSize="14"/>
<LegendFont FontName="宋体" FontSize="12"/>
</Font>
<ScriptLanguage Language="Jython"/>
<LookFeel Name="FlatLightLaf"/>
<Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,-7" MainFormSize="1293,693" ShowMeteoDataDlg="true"/>
<Startup MainFormLocation="-5,4" MainFormSize="1293,693" ShowMeteoDataDlg="false"/>
</MeteoInfo>

View File

@ -27,7 +27,7 @@
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>0.27</version>
<version>0.29</version>
</dependency>
</dependencies>
<properties>

View File

@ -1075,7 +1075,7 @@ public class FrmMain extends JFrame implements IApplication {
jPanel_MainToolBar.add(jToolBar_Edit);
//Split panel
jSplitPane1.setBackground(new java.awt.Color(255, 255, 255));
//jSplitPane1.setBackground(new java.awt.Color(255, 255, 255));
jSplitPane1.setDividerLocation(180);
jTabbedPane_Main.addChangeListener(new javax.swing.event.ChangeListener() {
@ -1732,7 +1732,7 @@ public class FrmMain extends JFrame implements IApplication {
this.loadDefaultPojectFile();
//this.loadConfigureFile();
this._mapDocument.setFont(this._options.getLegendFont());
//this._mapDocument.setFont(this._options.getLegendFont());
this.setLocation(this._options.getMainFormLocation());
this.setSize(this._options.getMainFormSize());
try {

View File

@ -245,9 +245,9 @@ public class FrmOptions extends javax.swing.JDialog {
private void jButton_OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OKActionPerformed
// TODO add your handling code here:
//Font
if (_legendFont != null) {
/*if (_legendFont != null) {
_parent.setLegendFont(_legendFont);
}
}*/
if (_textFont != null) {
_parent.getOptions().setTextFont(_textFont);
}