Skip to content

Commit

Permalink
Simplify tag visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
steffen-wilke committed Jan 23, 2021
1 parent 94acb5b commit 54b8163
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
1 change: 0 additions & 1 deletion utiliti/src/de/gurkenlabs/utiliti/Style.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public enum Theme {
public static final Color COLOR_MOUSE_SELECTION_AREA_FILL = new Color(0, 130, 152, 80);
public static final Color COLOR_MOUSE_SELECTION_AREA_BORDER = new Color(0, 130, 152, 150);
public static final Color COLOR_DEFAULT_TAG = new Color(99, 113, 118);
public static final Color COLOR_DEFAULT_TAG_HOVER = COLOR_DEFAULT_TAG.darker();
public static final Color COLOR_STATUS = Color.WHITE;

public static final Color COLOR_DARKTHEME_FOREGROUND = new Color(224, 224, 224);
Expand Down
25 changes: 3 additions & 22 deletions utiliti/src/de/gurkenlabs/utiliti/swing/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,14 @@ public Tag() {

this.panel = new InternalTagPanel();
this.panel.setBackground(Style.COLOR_DEFAULT_TAG);
this.panel.setLayout(new FlowLayout(FlowLayout.LEADING, 2, 2));
this.panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2));
add(this.panel);
FlowLayout flowLayout = (FlowLayout) getLayout();
flowLayout.setVgap(2);
flowLayout.setHgap(2);
flowLayout.setAlignment(FlowLayout.LEFT);

this.lblText = new JLabel("New label");
this.lblText.setForeground(Color.WHITE);
this.lblText.setFont(this.lblText.getFont().deriveFont(Style.getDefaultFont().getSize() * 0.75f));
this.panel.add(this.lblText);

this.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(final MouseEvent e) {
panel.setBackground(Style.COLOR_DEFAULT_TAG_HOVER);
}

@Override
public void mouseExited(final MouseEvent e) {
if (!deleteHovered) {
panel.setBackground(Style.COLOR_DEFAULT_TAG);
}
}
});

this.btnDelete = new JButton();
this.btnDelete.addActionListener(e -> {
final Container parent = this.getParent();
Expand All @@ -73,7 +55,6 @@ public void mouseExited(final MouseEvent e) {
public void mouseEntered(final MouseEvent e) {
btnDelete.setIcon(Icons.DELETE_X7);

panel.setBackground(Style.COLOR_DEFAULT_TAG_HOVER);
deleteHovered = true;
}

Expand All @@ -99,12 +80,12 @@ public void focusGained(FocusEvent e) {
}
});

this.btnDelete.setMargin(new Insets(2, 5, 2, 5));
this.btnDelete.setMargin(new Insets(2, 0, 2, 0));
this.btnDelete.setContentAreaFilled(false);
this.btnDelete.setBorderPainted(false);
this.btnDelete.setFocusPainted(false);
this.btnDelete.setBorder(null);
this.btnDelete.setPreferredSize(new Dimension(7, 7));
this.btnDelete.setPreferredSize(new Dimension(9, 9));
this.btnDelete.setIcon(Icons.DELETE_X7_DISABLED);
this.panel.add(this.btnDelete);
}
Expand Down

0 comments on commit 54b8163

Please sign in to comment.