Skip to content

Commit

Permalink
Merge 10ad5fd into e32fa1f
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsracz authored Mar 21, 2021
2 parents e32fa1f + 10ad5fd commit d764d97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src/org/openlcb/cdi/swing/CdiPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.Window;
Expand Down Expand Up @@ -120,6 +121,7 @@ public class CdiPanel extends JPanel {
public CdiPanel () {
super();
tabColorTimer = new Timer("OpenLCB CDI Reader Tab Color Timer");
setForeground(getBackground().darker());
}

/**
Expand Down Expand Up @@ -275,8 +277,9 @@ public java.awt.Dimension getMaximumSize() {
// Calls into JMRI to add the Create Sensor and Create Turnout buttons.
factory.handleGroupPaneEnd(createHelper);
CollapsiblePanel cp = new CollapsiblePanel("Sensor/Turnout creation", createHelper);
cp.setBackground(getForeground());
cp.setExpanded(false);
cp.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
cp.setBorder(BorderFactory.createMatteBorder(10,0,10,0, getForeground()));
//cp.setMinimumSize(new Dimension(0, cp.getPreferredSize().height));
add(cp);
}
Expand Down Expand Up @@ -845,6 +848,7 @@ public void visitSegment(ConfigRepresentation.SegmentEntry e) {
// ret.setBorder(BorderFactory.createLineBorder(java.awt.Color.RED)); //debugging
ret.setAlignmentY(Component.TOP_ALIGNMENT);
ret.setAlignmentX(Component.LEFT_ALIGNMENT);
ret.setBorder(BorderFactory.createMatteBorder(10,0,0,0, getForeground()));
contentPanel.add(ret);
EventQueue.invokeLater(() -> repack());
}
Expand Down Expand Up @@ -1110,7 +1114,7 @@ public Dimension getMaximumSize() {
}
};
area.setAlignmentX(Component.LEFT_ALIGNMENT);
area.setFont(UIManager.getFont("Label.font"));
area.setFont(UIManager.getFont("TextArea.font"));
area.setEditable(false);
area.setOpaque(false);
area.setWrapStyleWord(true);
Expand Down Expand Up @@ -1506,6 +1510,7 @@ private class EventIdPane extends EntryPane {

if (eventTable != null) {
eventNamesLabel = new JLabel();
eventNamesLabel.setFont(UIManager.getFont("TextArea.font"));
eventNamesLabel.setVisible(false);
eventListUpdateListener = new PropertyChangeListener() {
@Override
Expand Down
9 changes: 5 additions & 4 deletions src/util/CollapsiblePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import javax.imageio.ImageIO;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.MatteBorder;

public class CollapsiblePanel extends JPanel {
/** Comment for <code>serialVersionUID</code>. */
Expand All @@ -41,10 +43,10 @@ private class HeaderPanel extends JPanel implements MouseListener {
public HeaderPanel(String text) {
addMouseListener(this);
text_ = text;
font = new Font("sans-serif", Font.BOLD, 12);
font = UIManager.getFont("Label.font").deriveFont(Font.BOLD);
// setRequestFocusEnabled(true);
setPreferredSize(new Dimension(200, 20));

setMinimumSize(new Dimension(0, 32));
try {
closed = ImageIO.read(getClass().getResourceAsStream("/toolbarButtonGraphics/navigation/Forward24.gif"));
open = ImageIO.read(getClass().getResourceAsStream("/toolbarButtonGraphics/navigation/Down24.gif"));
Expand Down Expand Up @@ -98,7 +100,6 @@ public CollapsiblePanel(String text, JPanel panel) {
super(new GridBagLayout());

GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(1, 3, 0, 3);
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridwidth = GridBagConstraints.REMAINDER;
Expand All @@ -107,8 +108,8 @@ public CollapsiblePanel(String text, JPanel panel) {
selected = true;
headerPanel_ = new HeaderPanel(text == null ? "" : text);

setBackground(new Color(200, 200, 220));
contentPanel_ = panel;
contentPanel_.setBorder(new MatteBorder(0,20,0,0,contentPanel_.getBackground()));

add(headerPanel_, gbc);
add(contentPanel_, gbc);
Expand Down

0 comments on commit d764d97

Please sign in to comment.