Results 1 to 4 of 4
  1. #1
    gorbatsev is offline Member
    Join Date
    Jan 2012
    Posts
    4
    Rep Power
    0

    Default help with this jChart

    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionListener;

    import javax.swing.*;


    public class TestMain extends JFrame implements ActionListener,MouseMotionListener {

    private JComboBox combobox=null;
    private String items[]={"BML","GLM","FLM"};
    private JLabel label=null;
    private JPanel panel=null;
    private JButton swap=null;
    private JButton remove=null;
    private JLabel label2=null;

    public TestMain(){


    setSize(640,480);
    setLocation(50, 50);
    getContentPane().setLayout(null);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    combobox=new JComboBox(items);
    combobox.setSize(110,25);
    combobox.setLocation(250,5);
    combobox.addActionListener(this);
    combobox.addMouseMotionListener(this);
    add(combobox);

    label=new JLabel("This is a JFrame:");
    label.setSize(110,25);
    label.setLocation(150,5);
    label.addMouseMotionListener(this);
    add(label);

    panel=new JPanel();
    panel.setSize(500,350);
    panel.setLocation(50,50);
    panel.setBorder(BorderFactory.createLineBorder(Col or.black));
    panel.addMouseMotionListener(this);
    add(panel);

    label2=new JLabel();
    label2.setSize(110,25);
    label2.setLocation(150,5);
    panel.add(label2);

    swap=new JButton("swap");
    swap.setSize(110,25);
    swap.setLocation(120,405);
    swap.addActionListener(this);
    swap.addMouseMotionListener(this);
    add(swap);

    remove=new JButton("remove");
    remove.setSize(110,25);
    remove.setLocation(260,405);
    remove.addActionListener(this);
    remove.addMouseMotionListener(this);
    add(remove);

    repaint();
    }





    @Override
    public void actionPerformed(ActionEvent arg0) {
    // TODO Auto-generated method stub
    System.out.println(arg0.getActionCommand());
    if(arg0.getActionCommand().equals("comboBoxChanged ")){
    System.out.println(combobox.getSelectedItem());
    label.setText("1920,"+combobox.getSelectedItem().t oString()+":");
    panel.setBackground(Color.YELLOW);
    repaint();
    }

    }


    public static void main(String[] args) {
    new TestMain();
    }



    @Override
    public void mouseDragged(MouseEvent arg0) {
    // TODO Auto-generated method stub

    }


    @Override
    public void mouseMoved(MouseEvent arg0) {
    label2.setText(arg0.paramString());

    }
    }


    anyone?

  2. #2
    gorbatsev is offline Member
    Join Date
    Jan 2012
    Posts
    4
    Rep Power
    0

    Default Re: help with this jChart

    public class Thema3_1920 extends JFrame {

    private JButton buttons[]=null;

    public Thema3_1920(){


    setSize(640,480);
    setLocation(50, 50);
    getContentPane().setLayout(null);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    buttons=new JButton[8];
    for(int i=0;i<8;i++){
    buttons[i]=new JButton("button "+i);
    buttons[i].setSize(80,20);
    buttons[i].setLocation(-30+(8-i)*70,20+i*55);
    add(buttons[i]);
    }

    repaint();
    }

  3. #3
    gorbatsev is offline Member
    Join Date
    Jan 2012
    Posts
    4
    Rep Power
    0

    Default Re: help with this jChart

    public abstract class B {
    protected boolean a;
    protected String b;

    protected abstract void anAbstractBehavior();

    public String toString(){
    return super.toString()+"b:"+b;
    }
    }

    public class C extends B {
    protected String c;

    @Override
    protected void anAbstractBehavior() {
    // TODO Auto-generated method stub

    }


    }
    [
    public class D extends B implements E {
    protected int d;

    @Override
    protected void anAbstractBehavior() {
    // TODO Auto-generated method stub

    }

    @Override
    public void aMethod(String k) {
    // TODO Auto-generated method stub
    }

    public String toString(){
    return super.toString()+"d:"+d;
    }


    }
    public interface E {
    void aMethod(String k);
    }

  4. #4
    gorbatsev is offline Member
    Join Date
    Jan 2012
    Posts
    4
    Rep Power
    0

Similar Threads

  1. how can i add JChart in JPanel?
    By nandhinianand in forum NetBeans
    Replies: 1
    Last Post: 08-18-2011, 10:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •