Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BorderLayout;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import java.awt.GridBagLayout;
- import java.awt.Choice;
- import java.awt.GridBagConstraints;
- import java.awt.Insets;
- import javax.swing.JTextField;
- import java.awt.Button;
- public class Wyglad extends JFrame {
- private JPanel contentPane;
- private JTextField textField_1;
- private JTextField textField;
- private Button button;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- Wyglad frame = new Wyglad();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public Wyglad() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 450, 182);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- contentPane.setLayout(new BorderLayout(0, 0));
- setContentPane(contentPane);
- JPanel panel = new JPanel();
- contentPane.add(panel, BorderLayout.CENTER);
- GridBagLayout gbl_panel = new GridBagLayout();
- gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- gbl_panel.rowHeights = new int[]{0, 0, 0, 0, 0, 0};
- gbl_panel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE};
- gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
- panel.setLayout(gbl_panel);
- textField = new JTextField();
- textField.setHorizontalAlignment(JTextField.RIGHT);
- GridBagConstraints gbc_textField = new GridBagConstraints();
- gbc_textField.gridheight = 2;
- gbc_textField.gridwidth = 4;
- gbc_textField.insets = new Insets(0, 0, 5, 5);
- gbc_textField.fill = GridBagConstraints.HORIZONTAL;
- gbc_textField.gridx = 1;
- gbc_textField.gridy = 1;
- panel.add(textField, gbc_textField);
- textField.setColumns(10);
- textField_1 = new JTextField();
- textField_1.setHorizontalAlignment(JTextField.RIGHT);
- textField_1.setEditable(false);
- GridBagConstraints gbc_textField_1 = new GridBagConstraints();
- gbc_textField_1.gridheight = 2;
- gbc_textField_1.gridwidth = 4;
- gbc_textField_1.insets = new Insets(0, 0, 5, 5);
- gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
- gbc_textField_1.gridx = 9;
- gbc_textField_1.gridy = 1;
- panel.add(textField_1, gbc_textField_1);
- textField_1.setColumns(10);
- Choice choice = new Choice();
- String[] tab = {"af","fa","ga","Ga","gs"};
- for(String s: tab)
- {
- choice.add(s);
- }
- GridBagConstraints gbc_choice = new GridBagConstraints();
- gbc_choice.insets = new Insets(0, 0, 5, 5);
- gbc_choice.gridwidth = 3;
- gbc_choice.gridx = 3;
- gbc_choice.gridy = 3;
- panel.add(choice, gbc_choice);
- Choice choice_1 = new Choice();
- for(String s: tab)
- {
- choice_1.add(s);
- }
- GridBagConstraints gbc_choice_1 = new GridBagConstraints();
- gbc_choice_1.insets = new Insets(0, 0, 5, 0);
- gbc_choice_1.gridwidth = 3;
- gbc_choice_1.gridx = 11;
- gbc_choice_1.gridy = 3;
- panel.add(choice_1, gbc_choice_1);
- button = new Button("Przelicz");
- button.setActionCommand("Przelicz");
- GridBagConstraints gbc_button = new GridBagConstraints();
- gbc_button.insets = new Insets(0, 0, 0, 5);
- gbc_button.gridx = 6;
- gbc_button.gridy = 4;
- panel.add(button, gbc_button);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement