All pastes #411598 Raw Edit

tre

public text v1 · immutable
#411598 ·published 2007-03-27 03:41 UTC
rendered paste body
public class LineChart extends JPanel {
 public void printLegend(){
        JLabel legend = new JLabel();
        legend.setText("/ FirstLineß\n"+"/ SecondLine");
        legend.setBorder(new TitledBorder("Legende"));
        legend.setSize(legend.getSize());
       // legend.set)
        //  legend.setSize(50, 150);
        this.add(legend);
    }
    @Override
    protected void paintComponent(Graphics g){
        this.printLegend();       
    }
}

public class Test {
    public static void main(String[] args) {
        JFrame f = new JFrame("Try to do it right!"); 
        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); 
        f.setSize( 500, 500 ); 
        f.add( new LineChart() ); 
        f.setVisible( true );
        f.repaint();
    }
}