Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication5;
- public class JavaApplication5 {
- public static void main(String[] args) {
- new Frame();
- new Button();
- }
- }
- package javaapplication5;
- import javax.swing.*;
- public class Frame {
- public Frame(){
- CreatFrame();
- }
- JFrame Frame = new JFrame();
- public JFrame CreatFrame(){
- Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Frame.setVisible(true);
- Frame.setSize(500,500);
- Frame.setResizable(false);
- Frame.setLayout(null);
- return Frame;
- }
- public void addButton(JButton laws ){
- Frame.add(laws);
- }
- }
- package javaapplication5;
- import javax.swing.JButton;
- public class Button {
- public Button() {
- Frame AddButton = new Frame();
- AddButton.addButton(creatButton());
- }
- public JButton creatButton(){
- JButton asd = new JButton("Button");
- asd.setVisible(true);
- asd.setSize(100,70);
- asd.setLocation(175, 175);
- return asd;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement