List of usage examples for java.awt Panel add
public Component add(Component comp)
From source file:ClipMe.java
ClipMe() { super("Clipping Example"); add(tf = new TextField("Welcome"), "North"); add(ta = new TextArea(), "Center"); ta.setEditable(false);//w ww . j a v a2s.com Panel p = new Panel(); p.add(copy = new Button("Copy")); p.add(paste = new Button("Paste")); add(p, "South"); setSize(250, 250); }
From source file:SimpleInternalFrameDemo.java
public SimpleInternalFrameDemo() { super("Internal Frame Demo"); setSize(500, 400);/*from w w w .j a v a 2 s .com*/ openButton = new JButton("Open"); macButton = new JButton("Mac"); javaButton = new JButton("Metal"); motifButton = new JButton("Motif"); winButton = new JButton("Windows"); Panel p = new Panel(); p.add(openButton); p.add(macButton); p.add(javaButton); p.add(motifButton); p.add(winButton); add(p, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); openButton.addActionListener(new OpenListener()); LnFListener lnf = new LnFListener(this); macButton.addActionListener(lnf); javaButton.addActionListener(lnf); motifButton.addActionListener(lnf); winButton.addActionListener(lnf); // Set up the layered pane desktop = new JDesktopPane(); desktop.setOpaque(true); add(desktop, BorderLayout.CENTER); }
From source file:CardFrame.java
public CardFrame(String title) { setLayout(new BorderLayout(10, 10)); nextCard.addActionListener(this); prevCard.addActionListener(this); firstCard.addActionListener(this); lastCard.addActionListener(this); Panel buttonsPanel = new Panel(new FlowLayout(FlowLayout.CENTER)); buttonsPanel.add(firstCard); buttonsPanel.add(prevCard);//from w ww. j av a 2 s. c om buttonsPanel.add(nextCard); buttonsPanel.add(lastCard); setCardLayout(); add(BorderLayout.CENTER, cardPanel); add(BorderLayout.NORTH, buttonsPanel); }
From source file:SaveYourDrawingToFile.java
public SaveYourDrawingToFile() { addMouseListener(this); setLayout(new BorderLayout()); Panel pan = new Panel(); clearBtn.addActionListener(this); pan.add(clearBtn); saveBtn.addActionListener(this); pan.add(saveBtn);//from w ww. j a v a2s. com restoreBtn.addActionListener(this); pan.add(restoreBtn); quitBtn.addActionListener(this); pan.add(quitBtn); add("North", pan); setSize(350, 200); }
From source file:SimpleRotator.java
public SimpleRotator() { VirtualUniverse myUniverse = new VirtualUniverse(); Locale myLocale = new Locale(myUniverse); myLocale.addBranchGraph(buildViewBranch(myCanvas3D)); // myLocale.addBranchGraph(buildContentBranch(buildShape())); setTitle("SimpleRotator"); setSize(400, 400);/* ww w .ja va 2s . c o m*/ setLayout(new BorderLayout()); Panel bottom = new Panel(); bottom.add(exitButton); add(BorderLayout.CENTER, myCanvas3D); add(BorderLayout.SOUTH, bottom); exitButton.addActionListener(this); setVisible(true); }
From source file:GUIMediaStatistics.java
/********************************************************************** * Construct the GUIMediaStatistics object, constructing the various * components and laying them out on the screen. **********************************************************************/ public GUIMediaStatistics() { super("GUIMediaStatistics"); setLayout(new BorderLayout()); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);// w w w . ja v a 2s . c o m } }); Panel filePanel = new Panel(); filePanel.add(new Label("File:")); mediaField = new TextField(40); filePanel.add(mediaField); browseButton = new Button("browse..."); filePanel.add(browseButton); browseButton.addActionListener(this); getStatsButton = new Button("get stats..."); filePanel.add(getStatsButton); getStatsButton.addActionListener(this); add(filePanel, "North"); results = new TextArea(80, 10); results.setEditable(false); add(results, "Center"); }
From source file:BouncingBall.java
public BouncingBall() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D c = new Canvas3D(config); add("Center", c); c.addKeyListener(this); timer = new Timer(100, this); //timer.start(); Panel p = new Panel(); p.add(go); add("North", p); go.addActionListener(this); go.addKeyListener(this); // Create a simple scene and attach it to the virtual universe BranchGroup scene = createSceneGraph(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene);/*from ww w. j av a 2 s.c o m*/ }
From source file:SimpleLOD.java
public SimpleLOD() { VirtualUniverse myUniverse = new VirtualUniverse(); Locale myLocale = new Locale(myUniverse); myLocale.addBranchGraph(buildViewBranch(myCanvas3D)); myLocale.addBranchGraph(buildContentBranch()); setTitle("SimpleLOD"); setSize(400, 400);// w ww . jav a 2 s .c om setLayout(new BorderLayout()); Panel bottom = new Panel(); bottom.add(exitButton); add(BorderLayout.CENTER, myCanvas3D); add(BorderLayout.SOUTH, bottom); exitButton.addActionListener(this); setVisible(true); }
From source file:SimpleKeyNav.java
public SimpleKeyNav() { VirtualUniverse myUniverse = new VirtualUniverse(); Locale myLocale = new Locale(myUniverse); myLocale.addBranchGraph(buildViewBranch(myCanvas3D)); myLocale.addBranchGraph(buildContentBranch()); setTitle("SimpleKeyNav"); setSize(400, 400);//w ww . j a va 2 s .com setLayout(new BorderLayout()); Panel bottom = new Panel(); bottom.add(exitButton); add(BorderLayout.CENTER, myCanvas3D); add(BorderLayout.SOUTH, bottom); exitButton.addActionListener(this); setVisible(true); }
From source file:SimpleMouse.java
public SimpleMouse() { VirtualUniverse myUniverse = new VirtualUniverse(); Locale myLocale = new Locale(myUniverse); myLocale.addBranchGraph(buildViewBranch(myCanvas3D)); myLocale.addBranchGraph(buildContentBranch()); setTitle("SimpleMouse"); setSize(400, 400);/*www . ja va 2s. c om*/ setLayout(new BorderLayout()); Panel bottom = new Panel(); bottom.add(exitButton); add(BorderLayout.CENTER, myCanvas3D); add(BorderLayout.SOUTH, bottom); exitButton.addActionListener(this); setVisible(true); }