public Plot2Da() { check_ = new JCheckBox("Hold on"); plot_ = new Plot2D(); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 2, 2, 2); c.weightx = 1.0; c.weighty = 1.0; c.gridheight = 1; c.gridwidth = 1; c.gridx = 0; c.gridy = 0; add(check_, c); c.gridwidth = 1; c.gridheight = 1; c.gridx = 0; c.gridy = 1; c.fill = GridBagConstraints.REMAINDER; c.ipadx = plot_.getSize().width + 100; c.ipady = plot_.getSize().height + 100; plot_.setBackground(Color.WHITE); add(plot_, c); setBorder(BorderFactory.createEtchedBorder()); }
public static void main(String[] args) { Plot2D test = new Plot2D(); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(test.getContent()); f.add(test.getUIPanel(), "Last"); f.setSize(400, 400); f.setLocation(50, 50); f.setVisible(true); }
/** Adds more colours to the colour list */ private void extendColourMap() { if (m_plotInstances.attribute(m_cIndex).isNominal()) { for (int i = m_colorList.size(); i < m_plotInstances.attribute(m_cIndex).numValues(); i++) { Color pc = m_DefaultColors[i % 10]; int ija = i / 10; ija *= 2; for (int j = 0; j < ija; j++) { pc = pc.brighter(); } if (m_backgroundColor != null) { pc = Plot2D.checkAgainstBackground(pc, m_backgroundColor); } m_colorList.add(pc); } } }