JInternalFrame mydialog = new JInternalFrame(); ((BasicInternalFrameUI)mydialog.getUI()).getNorthPane().getHeight();
public void propertyChange(PropertyChangeEvent evt) { String prop = (String)evt.getPropertyName(); JInternalFrame f = (JInternalFrame)evt.getSource(); TinyInternalFrameUI ui = (TinyInternalFrameUI)f.getUI(); if(prop.equals("JInternalFrame.isPalette")) { if(evt.getNewValue() != null) { ui.setPalette(((Boolean)evt.getNewValue()).booleanValue()); } else { ui.setPalette(false); } } super.propertyChange(evt); } }
JInternalFrame inFrame = new JInternalFrame(); BasicInternalFrameTitlePane titlePane = (BasicInternalFrameTitlePane) ((BasicInternalFrameUI) inFrame.getUI()). getNorthPane(); inFrame.remove(titlePane);
private void recalculateDDLFrameSize(JInternalFrame ddlFrame, JTextPane txtDDL, String[] lines) { FontMetrics fm = txtDDL.getFontMetrics(txtDDL.getFont()); int txtHeight = fm.getHeight() * lines.length; int txtWidht = 0; for (int i = 0; i < lines.length; i++) { txtWidht = Math.max(txtWidht, fm.stringWidth(lines[i])); } BasicInternalFrameUI ui = (BasicInternalFrameUI) ddlFrame.getUI(); int titleHeight = ui.getNorthPane().getHeight(); ddlFrame.setSize(txtWidht + 20, txtHeight + titleHeight + 20); }
/** * Returns the title pane of the specified root pane. * * @param rootPane * Root pane. * @return The title pane of the specified root pane. */ public static JComponent getTitlePane(JRootPane rootPane) { JInternalFrame jif = (JInternalFrame) SwingUtilities .getAncestorOfClass(JInternalFrame.class, rootPane); if ((jif != null) && (jif.getUI() instanceof SubstanceInternalFrameUI)) { SubstanceInternalFrameUI ui = (SubstanceInternalFrameUI) jif .getUI(); return ui.getTitlePane(); } SubstanceRootPaneUI ui = (SubstanceRootPaneUI) rootPane.getUI(); if (ui == null) return null; return ui.getTitlePane(); }
JInternalFrame[] frames = desktop.getAllFrames(); for (JInternalFrame frame: frames) { BasicInternalFrameUI ui = (BasicInternalFrameUI) frame.getUI(); Component northPane = ui.getNorthPane(); MouseMotionListener[] motionListeners = (MouseMotionListener[]) northPane.getListeners(MouseMotionListener.class); for (MouseMotionListener listener: motionListeners) northPane.removeMouseMotionListener(listener); } }
public static void addOnScreen(JInternalFrame inFrame, String title) { //border for the internal frame javax.swing.plaf.InternalFrameUI ifu = inFrame.getUI(); ((javax.swing.plaf.basic.BasicInternalFrameUI) ifu).setNorthPane(null); Border b1 = new LineBorder(new Color(114, 139, 173), 3, true) { }; tabbedPane.setBounds(0, 0, jDesktopPane1.getWidth(), jDesktopPane1.getHeight()); inFrame.setLocation(0, 0); inFrame.setSize(jDesktopPane1.getWidth(), jDesktopPane1.getHeight()); inFrame.setBorder(b1); JPanel jp = new JPanel(); jp.setLayout(new GridLayout()); jp.setOpaque(true); jp.add(inFrame); tabbedPane.addTab(title, jp); tabbedPane.setSelectedComponent(jp); inFrame.requestFocusInWindow(); inFrame.setVisible(true); tabbedPane.setVisible(true); }
panel.add(new JScrollPane(toShow), BorderLayout.CENTER); if(!(System.getProperty("os.name").startsWith("Mac OS"))){ BasicInternalFrameUI ui = (BasicInternalFrameUI) popup.getUI(); ui.getNorthPane().setPreferredSize(new Dimension(0,0));
frameHeight -= (borderInsets.top + borderInsets.bottom); BasicInternalFrameUI frameUI = (BasicInternalFrameUI) frame.getUI(); JComponent frameTitlePane = frameUI.getNorthPane();
import javax.swing.*; import javax.swing.plaf.basic.BasicInternalFrameUI; class A{ public void doIt(){ JFrame fr = new JFrame(); fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); fr.setSize(300,300); JInternalFrame f = new JInternalFrame(); f.setSize(200,200); fr.add(f); BasicInternalFrameUI ui = (BasicInternalFrameUI) f.getUI(); ui.setNorthPane(null); f.setVisible(true); fr.setVisible(true); } public static void main(String a[]){ A obj = new A(); obj.doIt(); } }
/** * Returns the title pane of the specified root pane. * * @param rootPane * Root pane. * @return The title pane of the specified root pane. */ public static JComponent getTitlePane(JRootPane rootPane) { JInternalFrame jif = (JInternalFrame) SwingUtilities .getAncestorOfClass(JInternalFrame.class, rootPane); if (jif != null) { SubstanceInternalFrameUI ui = (SubstanceInternalFrameUI) jif .getUI(); return ui.getTitlePane(); } SubstanceRootPaneUI ui = (SubstanceRootPaneUI) rootPane.getUI(); if (ui == null) return null; return ui.getTitlePane(); }
internalFrame.putClientProperty("JInternalFrame.isPalette", true); } else { ((BasicInternalFrameUI) internalFrame.getUI()).setNorthPane(null);
private void propagateModificationState() { JComponent titlePane = getTitlePane(); if (titlePane instanceof SubstanceTitlePane) { ((SubstanceTitlePane) titlePane) .getCloseButton() .putClientProperty( SubstanceLookAndFeel.WINDOW_MODIFIED, root .getClientProperty(SubstanceLookAndFeel.WINDOW_MODIFIED)); return; } JInternalFrame jif = (JInternalFrame) SwingUtilities .getAncestorOfClass(JInternalFrame.class, this.root); if (jif != null) { SubstanceInternalFrameUI internalFrameUI = (SubstanceInternalFrameUI) jif .getUI(); internalFrameUI.setWindowModified(Boolean.TRUE.equals(root .getClientProperty(SubstanceLookAndFeel.WINDOW_MODIFIED))); } }
private void propagateModificationState() { JComponent titlePane = getTitlePane(); if (titlePane instanceof SubstanceTitlePane) { ((SubstanceTitlePane) titlePane) .getCloseButton() .putClientProperty( SubstanceLookAndFeel.WINDOW_MODIFIED, root .getClientProperty(SubstanceLookAndFeel.WINDOW_MODIFIED)); return; } JInternalFrame jif = (JInternalFrame) SwingUtilities .getAncestorOfClass(JInternalFrame.class, this.root); if (jif != null) { SubstanceInternalFrameUI internalFrameUI = (SubstanceInternalFrameUI) jif .getUI(); internalFrameUI.setWindowModified(Boolean.TRUE.equals(root .getClientProperty(SubstanceLookAndFeel.WINDOW_MODIFIED))); } }
BasicInternalFrameUI ui = (BasicInternalFrameUI)internalFrame1.getUI(); Container north = (Container)ui.getNorthPane(); north.remove(0); north.repaint(); for(MouseListener listener : ((javax.swing.plaf.basic.BasicInternalFrameUI) internalFrame1.getUI()).getNorthPane().getMouseListeners()){ ((javax.swing.plaf.basic.BasicInternalFrameUI) internalFrame1.getUI()).getNorthPane().removeMouseListener(listener);
BasicInternalFrameTitlePane titlePane = (BasicInternalFrameTitlePane) ((BasicInternalFrameUI) jInternalFrame.getUI()).getNorthPane(); jInternalFrame.remove(titlePane);
BasicInternalFrameTitlePane titlePane = (BasicInternalFrameTitlePane) ((BasicInternalFrameUI) jInternalFrame.getUI()).getNorthPane(); jInternalFrame.remove(titlePane);
public void internalFrameOpened(final InternalFrameEvent _evt) { super.internalFrameOpened(_evt); if (cmdListener_ != null) { cmdListener_.internalFrameOpened(_evt); } final JInternalFrame frame = _evt.getInternalFrame(); if (!BuLib.isPalette(frame)) { final InternalFrameUI ui = frame.getUI(); if (ui instanceof BasicInternalFrameUI && ((BasicInternalFrameUI) ui).getNorthPane() != null) { ((BasicInternalFrameUI) ui).getNorthPane().add(new BuButton(BuResource.BU.getToolIcon("aide"))); ((BasicInternalFrameUI) ui).getNorthPane().addMouseListener(new MouseAdapter() { public void mouseClicked(final MouseEvent _e) { if (SwingUtilities.isRightMouseButton(_e)) { final CtuluPopupMenu pop = new CtuluPopupMenu(); pop.addMenuItem(BuResource.BU.getString("Arranger les fentres"), "RANGERFRAMES", FudaaResource.FUDAA .getToolIcon("arrange-frames_16.png"), true, FudaaCommonImplementation.this); pop.addMenuItem(BuResource.BU.getString("renommer"), "RENAMEFRAMES", BuResource.BU .getToolIcon("renommer"), true, new ActionListener() { public void actionPerformed(final ActionEvent _evtAct) { final Point p = _e.getComponent().getLocationOnScreen(); FudaaCommonImplementation.this.renameInternalFrame(p.x + _e.getX(), p.y + _e.getY()); } }); pop.show(FudaaCommonImplementation.this.getCurrentInternalFrame(), _e.getX(), _e.getY()); } } }); } } }