List of usage examples for javax.swing JInternalFrame setLocation
public void setLocation(Point p)
From source file:de.codesourcery.jasm16.ide.ui.viewcontainers.Perspective.java
@Override public IView addView(final IView view) { if (view == null) { throw new IllegalArgumentException("view must not be NULL"); }//from w w w . ja v a2 s . c om final JInternalFrame internalFrame = new JInternalFrame(view.getTitle(), true, true, true, true); internalFrame.setBackground(Color.BLACK); internalFrame.setForeground(Color.GREEN); internalFrame.getContentPane().add(view.getPanel(this)); SizeAndLocation sizeAndLoc = applicationConfig.getViewCoordinates(getUniqueID(view)); if (sizeAndLoc != null) { internalFrame.setSize(sizeAndLoc.getSize()); internalFrame.setLocation(sizeAndLoc.getLocation()); } else { internalFrame.setSize(200, 150); internalFrame.setLocation(0, 0); internalFrame.pack(); } internalFrame.setVisible(true); final InternalFrameWithView frameAndView = new InternalFrameWithView(internalFrame, view); final InternalFrameListener listener = new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { disposeView(view); } }; internalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE); internalFrame.addInternalFrameListener(listener); views.add(frameAndView); desktop.add(internalFrame); return view; }
From source file:com.tag.FramePreferences.java
@SuppressWarnings("serial") public FramePreferences(final JInternalFrame frame, String pathName) { setFrame(new Frame() { @Override/* www .j a v a2 s. c om*/ public synchronized int getExtendedState() { if (frame.isMaximum()) { return Frame.MAXIMIZED_BOTH; } else if (frame.isIcon()) { return Frame.ICONIFIED; } else { return Frame.NORMAL; } } @Override public synchronized void setExtendedState(int state) { try { switch (state) { case Frame.MAXIMIZED_HORIZ: case Frame.MAXIMIZED_VERT: case Frame.MAXIMIZED_BOTH: frame.setMaximum(true); break; case Frame.ICONIFIED: frame.setIcon(true); break; case Frame.NORMAL: frame.setIcon(false); frame.setMaximum(false); break; } } catch (PropertyVetoException e) { e.printStackTrace(); } } @Override public synchronized void addWindowStateListener(final WindowStateListener l) { final Frame source = this; frame.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameIconified(InternalFrameEvent e) { l.windowStateChanged(new WindowEvent(source, WindowEvent.WINDOW_ICONIFIED)); } @Override public void internalFrameDeiconified(InternalFrameEvent e) { l.windowStateChanged(new WindowEvent(source, WindowEvent.WINDOW_DEICONIFIED)); } }); } @Override public synchronized void removeWindowStateListener(WindowStateListener l) { super.removeWindowStateListener(l); } @Override public GraphicsConfiguration getGraphicsConfiguration() { return frame.getGraphicsConfiguration(); } public Point getLocation() { return frame.getLocation(); } @Override public void setLocation(Point p) { frame.setLocation(p); } @Override public Dimension getSize() { return frame.getSize(); } @Override public void setSize(Dimension size) { frame.setSize(size); } @Override public synchronized void addComponentListener(ComponentListener l) { frame.addComponentListener(l); } @Override public synchronized void removeComponentListener(ComponentListener l) { frame.addComponentListener(l); } }); setPathName(pathName); }