List of usage examples for javax.swing JComponent add
public Component add(String name, Component comp)
From source file:org.jcurl.demo.tactics.JCurlShotPlanner.java
@Override protected void startup() { // set the window icon: {/*w w w. j a v a2s . c o m*/ final Image img; if (true) img = getContext().getResourceMap().getImageIcon("Application.icon").getImage(); else { final ResourceMap r = getContext().getResourceMap(); if (true) try { img = ImageIO.read(this.getClass() .getResource("/" + r.getResourcesDir() + "/" + r.getString("Application.icon"))); } catch (final IOException e) { throw new RuntimeException("Unhandled", e); } else img = Toolkit.getDefaultToolkit().createImage(this.getClass() .getResource("/" + r.getResourcesDir() + "/" + r.getString("Application.icon"))); } getMainFrame().setIconImage(img); // SystemTray tray = SystemTray.getSystemTray(); } // File Filter jcxzPat = gui.createFileFilter("fileFilterJcxz", "jcz", "jcx"); pngPat = gui.createFileFilter("fileFilterPng", "png"); svgPat = gui.createFileFilter("fileFilterSvg", "svgz", "svg"); getMainFrame().setJMenuBar(createMenuBar()); final JComponent c = new JPanel(); c.setLayout(new BorderLayout()); tactics.setPreferredSize(new Dimension(400, 600)); c.add(tactics, BorderLayout.CENTER); c.add(url, BorderLayout.NORTH); { final JPanel b = new JPanel(); b.setLayout(new BorderLayout()); final JTabbedPane t = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT); t.add("Rock", broomSwing); t.setMnemonicAt(0, 'R'); t.add("Ice", curlerSwing); t.setMnemonicAt(1, 'I'); t.add("Collission", new JLabel("TODO: Collission settings")); t.setMnemonicAt(2, 'C'); b.add(t, BorderLayout.NORTH); if (false) b.add(new JLabel("TODO: Bird's eye view"), BorderLayout.CENTER); else b.add(birdPiccolo, BorderLayout.CENTER); c.add(b, BorderLayout.EAST); } show(c); view12Foot(); }
From source file:org.xulux.swing.util.NativeWidgetHandler.java
/** * @see org.xulux.nyx.gui.INativeWidgetHandler#addWidgetToParent(org.xulux.nyx.gui.Widget, java.lang.Object) *//*from w ww . j a v a 2s .c o m*/ public void addWidgetToParent(Widget widget, Object parentWidget) { if (!(parentWidget instanceof JComponent) || widget == null) { return; } JComponent comp = (JComponent) parentWidget; Object nativeWidget = widget.getNativeWidget(); if (nativeWidget instanceof Component) { comp.add((Component) widget.getNativeWidget(), widget); } }