Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[]args) {
- Window window = new Window();
- window.initializeFrame();
- PanelPhone panelPhone = new PanelPhone();
- panelPhone.initializePanelPhone();
- window.add(panelPhone);
- }
- }
- import javax.swing.*;
- import javax.swing.border.EtchedBorder;
- import java.awt.*;
- public class PanelPhone extends JPanel {
- JPanel panel;
- public PanelPhone() {
- panel = new JPanel();
- panel.setVisible(true);
- }
- void initializePanelPhone() {
- panel.setLayout(null);
- panel.setBorder(new EtchedBorder());
- panel.setBackground(Color.GRAY);
- panel.setLocation(20, 20);
- panel.setSize(300,200);
- add(panel);
- }
- }
- import javax.swing.*;
- import java.awt.*;
- public class Window extends Frame {
- private JFrame frame;
- public Window(){
- frame = new JFrame("Phone");
- frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- frame.setVisible(true);
- }
- public void initializeFrame() {
- frame.setSize(new Dimension(1000 ,900));
- frame.setLocationRelativeTo(null);
- frame.setLayout(null);
- }
- }
Add Comment
Please, Sign In to add comment