All pastes #32210 Raw Edit

Something

public text v1 · immutable
#32210 ·published 2005-12-03 10:20 UTC
rendered paste body
import java.awt.*;
import javax.swing.*;

import java.awt.event.*;
import java.awt.geom.Rectangle2D;





public class Graph {
	JTextArea output;
    JFrame Page;
	int ilosc;
	void show(){
		ilosc=10;
		Page = new JFrame("Wykresy");
		final JCheckBox[] boxy = new JCheckBox[ilosc];
		final JTextField[] txty = new JTextField[ilosc];
		JButton Rys = new JButton("Rysuj");
		
		JPanel Obraz;
				
		for(int i = 0 ; i < ilosc ; i++)
		{
	
		boxy[i]= new JCheckBox("Zmienna " + (i+1),true);
        boxy[i].setMnemonic(KeyEvent.VK_C);
        

		}
		
		for(int i = 0 ; i < ilosc ; i++)
		{
	
		txty[i]= new JTextField();
        
		}
		
		JPanel Przyciski = new JPanel(new GridLayout(0, 1));
		JPanel Txty = new JPanel(new GridLayout(0, 1));
		JPanel Menu = new JPanel(new GridLayout(0, 1));
		
		for(int i = 0; i< ilosc ; i++)
		Przyciski.add(boxy[i]);
		
		for(int i = 0; i< ilosc ; i++)
			Txty.add(txty[i]);
		
		Obraz = new JPanel(){
			public void paint(Graphics g2){
				Graphics2D g = (Graphics2D) g2;
				int ile = 0;
				for ( int i = 0 ; i< ilosc ; i++)
					if(boxy[i].isSelected()) {
						
					}
				g.drawString(""+ile,20,20);
			}
		};
		Obraz.setMinimumSize(new Dimension(1000,1000));
		Menu.add(Przyciski);
		Menu.add(Txty);
		Menu.add(Rys);
		Menu.add(Obraz);
		
		Rys.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent a){
				//Page.repaint();
				JFrame Obraz2; 
				Obraz2 = new JFrame(){
					public void paint(Graphics g2){
						Graphics2D g = (Graphics2D) g2;
						int ile = 0;
						for ( int i = 0 ; i< ilosc ; i++)
							if(boxy[i].isSelected()) {
								
							}
						g.drawString(""+ile,20,20);
					}
				};
				Obraz2.pack();
				Obraz2.setVisible(true);
			}
		}
		);
		
		Page.add(Menu);
		
		Page.pack();
		
        Page.setVisible(true);
	}
	
	
}