@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (g instanceof Graphics2D) { ((Graphics2D) g) .setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } g.setColor(tagSet.equals(highlighted) ? color.brighter() : color); g.fillRoundRect(x, y, ICON_WIDTH - 1, ICON_HEIGHT - 1, ICON_WIDTH / 2, ICON_WIDTH / 2); g.setColor(color.darker()); g.drawRoundRect(x, y, ICON_WIDTH - 1, ICON_HEIGHT - 1, ICON_WIDTH / 2, ICON_WIDTH / 2); }
@Override public void mouseExited(MouseEvent e) { if (tagSet.equals(highlighted)) { highlighted = null; } Object source = e.getSource(); if (source instanceof JComponent) { ((JComponent) source).repaint(); } chart.repaint(); }
/* * Write a tag. */ public void writeTag(Tag tag) throws IOException { int tagID = tag.getTag(); if (!tagSet.exists(tagID)) { throw new UndefinedTagException(tagID); } pushBuffer(); tag.write(tagID, this); int align = getTagAlignment(); int pad = (align - (getBufferLength() % align)) % align; for (int i = 0; i < pad; i++) { write(0); } int len = popBuffer(); TagHeader header = createTagHeader(tag, len); writeTagHeader(header); append(); }
private JPanel makeEntry(TagSet tagSet) { JPanel entry = new JPanel(); entry.setOpaque(false); entry.setLayout(new BoxLayout(entry, BoxLayout.LINE_AXIS)); entry.add(new JLabel(new LegendIcon(tagSet))); for (TagCapability tag : tagSet.tags) { JComponent view = LabelView.VIEW_INFO.createView(tag.getComponentRepresentation()); view.setForeground(Color.LIGHT_GRAY); entry.add(view); } if (tagSet.tags.isEmpty()) { JLabel label = new JLabel(tagSet.toString()); label.setForeground(Color.LIGHT_GRAY); entry.add(label); } entry.setAlignmentX(LEFT_ALIGNMENT); entry.addMouseListener(new Highlighter(tagSet)); return entry; }
public OrderedInfiniteNonPeriodicTagSet(int piExpressionType) { super.setExpressionType(piExpressionType); }
@Override public int compareTo(TagSet other) { return toString().compareTo(other.toString()); }
public LegendIcon(TagSet tagSet) { this.tagSet = tagSet; this.color = ScenarioColorPalette.getColor(tagSet.toString()); }