Java 类javax.swing.plaf.basic.BasicInternalFrameUI 实例源码

项目:AgentWorkbench    文件:MaximizedTab.java   
/**
     * Initialize.
     */
    private void initialize() {

        this.setClosable(true);
        this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
        this.setVisible(true);
        this.registerEscapeKeyStroke();
        this.addInternalFrameListener(new InternalFrameAdapter() {
            /* (non-Javadoc)
             * @see javax.swing.event.InternalFrameAdapter#internalFrameClosing(javax.swing.event.InternalFrameEvent)
             */
            @Override
            public void internalFrameClosing(InternalFrameEvent ife) {
                projectWindow.tabRestore();
                super.internalFrameClosing(ife);
            }
            /* (non-Javadoc)
             * @see javax.swing.event.InternalFrameAdapter#internalFrameDeactivated(javax.swing.event.InternalFrameEvent)
             */
            @Override
            public void internalFrameDeactivated(InternalFrameEvent e) {
//              projectWindow.tabRestore();
                super.internalFrameDeactivated(e);
            }

        });
        ((BasicInternalFrameUI) this.getUI()).setNorthPane(null);

        // --- Add ComponentListener to MainWindow -------- 
        this.addComponentListenerOfMainWindow();

    }
项目:AgentWorkbench    文件:ProjectWindow.java   
/**
 * Maximise the Project-Window within the AgenGUI-Application
 */
public void setMaximized() {

    MainWindow mainWindow = Application.getMainWindow();
    if (mainWindow != null) {
        // --- Validate the main application window -----------------
        mainWindow.validate();
        // --- Be sure that everything is there as needed -----------
        if (this.getParent() != null) {
            ((BasicInternalFrameUI) this.getUI()).setNorthPane(null);
            DesktopManager dtm = mainWindow.getJDesktopPane4Projects().getDesktopManager();
            if (dtm != null) {
                dtm.maximizeFrame(this);
            }
        }
        mainWindow.setCloseButtonPosition(true);
    }
}
项目:AgentWorkbench    文件:BasicGraphGuiProperties.java   
/**
 * This method initializes this
 * @return void
 */
private void initialize() {

    this.setAutoscrolls(true);
    this.setMaximizable(true);
    this.setResizable(true);
    this.setIconifiable(true);

    this.setClosable(true);
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    this.setTitle("Component");

    // --- Remove Frame menu ----------------
    BasicInternalFrameUI ui = (BasicInternalFrameUI)this.getUI();
    ui.getNorthPane().remove(0);

    this.addInternalFrameListener(new InternalFrameAdapter() {
        @Override
        public void internalFrameClosing(InternalFrameEvent ife) {
            doClose();
        }
    });

    this.configureForGraphObject();
    this.setContentPane(this.getJContentPane());
    this.setSize(this.defaultWidth, this.defaultHeight);
    this.setInitialSizeAndPosition();

    // --- Call to the super-class ----------
    this.registerAtDesktopAndSetVisible();

}
项目:minimal-j    文件:EditablePanel.java   
public void setContent(JComponent content) {
    JInternalFrame frame = new JInternalFrame("") {
        private static final long serialVersionUID = 1L;

        @Override
        public void updateUI() {
            super.updateUI();
            setBorder(null);
            BasicInternalFrameUI bi = (BasicInternalFrameUI) getUI();
            bi.setNorthPane(null);
        }
    };
    frame.setLayout(new BorderLayout());
    frame.add(content, BorderLayout.CENTER);
    add(frame);
    frame.setVisible(true);
    try {
        frame.setMaximum(true);
    } catch (PropertyVetoException e) {
        LOG.log(Level.WARNING, e.getLocalizedMessage(), e);
    }
}
项目:nabs    文件:NabInternalFrame.java   
public NabInternalFrame(String title) {
    super(title);

    listeners = new LinkedList();
    isDetached = false;

    createMenu();
    setMaximizable(true);
    setClosable(true);
    setIconifiable(true);
    setResizable(true);

    BasicInternalFrameUI ui = (BasicInternalFrameUI)getUI();
    if(ui != null && ui.getNorthPane() != null){
        ui.getNorthPane().addMouseListener(new MListener());
    }
}
项目:nabs    文件:NabInternalFrame.java   
public NabInternalFrame(String title) {
    super(title);

    listeners = new LinkedList();
    isDetached = false;

    createMenu();
    setMaximizable(true);
    setClosable(true);
    setIconifiable(true);
    setResizable(true);

    BasicInternalFrameUI ui = (BasicInternalFrameUI)getUI();
    if(ui != null && ui.getNorthPane() != null){
        ui.getNorthPane().addMouseListener(new MListener());
    }
}
项目:nabs    文件:NabInternalFrame.java   
public NabInternalFrame(String title) {
    super(title);

    listeners = new LinkedList();
    isDetached = false;

    createMenu();
    setMaximizable(true);
    setClosable(true);
    setIconifiable(true);
    setResizable(true);

    BasicInternalFrameUI ui = (BasicInternalFrameUI)getUI();
    if(ui != null && ui.getNorthPane() != null){
        ui.getNorthPane().addMouseListener(new MListener());
    }
    //this.getRootPane().addMouseListener(new MListener());
}
项目:java-swing-tips    文件:MainPanel.java   
private static void addFrame(JDesktopPane desktop, int idx) {
    String titleAlignment = idx == 0 ? "CENTER" : "LEADING";
    JInternalFrame frame = new JInternalFrame("title: " + titleAlignment, true, true, true, true);

    BasicInternalFrameUI ui = (BasicInternalFrameUI) frame.getUI();
    JComponent titleBar = (JComponent) ui.getNorthPane();
    UIDefaults d = new UIDefaults();
    d.put("InternalFrame:InternalFrameTitlePane.titleAlignment", titleAlignment);
    titleBar.putClientProperty("Nimbus.Overrides", d);

    frame.add(makePanel());
    frame.setSize(240, 100);
    frame.setVisible(true);
    frame.setLocation(10 + 60 * idx, 10 + 120 * idx);
    desktop.add(frame);
    desktop.getDesktopManager().activateFrame(frame);
}
项目:AgentWorkbench    文件:ProjectWindow.java   
/**
 * This method initializes this.
 */
private void initialize() {

    this.setSize(850, 500);
    this.setContentPane(this.getJSplitPaneProjectView());
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.setClosable(true);
    this.setMaximizable(true);
    this.setResizable(false);
    this.setAutoscrolls(true);
    this.setBorder(null);
    this.setFocusable(true);
    ((BasicInternalFrameUI) this.getUI()).setNorthPane(null);
}
项目:AgentWorkbench    文件:AddComponentDialog.java   
/**
   * This method initializes this
   * @return void
   */
  private void initialize() {

    this.setContentPane(getJSplitPaneContent());
this.setTitle("Add Network Component");
this.setBounds(new Rectangle(0, 0, 240, 410));
this.setTitle(Language.translate(this.getTitle(), Language.EN));
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.registerEscapeKeyStroke();

this.setClosable(true);
this.setMaximizable(false);
this.setIconifiable(false);

this.setAutoscrolls(true);
this.setResizable(true);

BasicInternalFrameUI ui = (BasicInternalFrameUI)this.getUI();
ui.getNorthPane().remove(0);

// --- Call to the super-class ----------
if (this.isHiddenFactory==false) {
    this.registerAtDesktopAndSetVisible();  
    this.graphDesktop.addComponentListener(this.getComponentAdapter4Desktop());
}

  }
项目:JetUML    文件:WelcomeTab.java   
/**
 * @param pNewFileMenu The NewFileMenu to link to the WelcomeTab.
 * @param pRecentFileMenu The RecentFileMenu to link to the WelcomeTab.
 */
public WelcomeTab(JMenu pNewFileMenu, JMenu pRecentFileMenu)
{
    aWelcomeResources = ResourceBundle.getBundle("ca.mcgill.cs.jetuml.gui.EditorStrings");
    aLeftPanelIcon = new ImageIcon(getClass().getClassLoader().getResource(aWelcomeResources.getString("welcome.create.icon")));
    aRightPanelIcon = new ImageIcon(getClass().getClassLoader().getResource(aWelcomeResources.getString("welcome.open.icon"))); 
    setOpaque(false);
    setLayout(new BorderLayout());

    BasicInternalFrameUI ui = (BasicInternalFrameUI)getUI();
    Container north = ui.getNorthPane();
    north.remove(0);
    north.validate();
    north.repaint();

    aNewFileMenu = pNewFileMenu;
    aRecentFileMenu = pRecentFileMenu;
    JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    panel.setOpaque(false);

    JPanel shortcutPanel = new JPanel();
    shortcutPanel.setOpaque(false);
    shortcutPanel.setLayout(new GridLayout(2, 2));
    shortcutPanel.add(getLeftTitlePanel());
    shortcutPanel.add(getRightTitlePanel());
    shortcutPanel.add(getLeftPanel());
    shortcutPanel.add(getRightPanel());
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.NORTH;
    c.weightx = 1;
    c.gridx = 0;
    c.gridy = 1;
    panel.add(shortcutPanel, c);

    add(panel, BorderLayout.NORTH);
    add(getFootTextPanel(), BorderLayout.SOUTH);
    setComponentPopupMenu( null ); // Removes the system pop-up menu full of disabled buttons.
}
项目:JetUML    文件:EditorFrame.java   
private void addTab(final JInternalFrame pInternalFrame)
{  
 int frameCount = aTabbedPane.getComponentCount();   
 BasicInternalFrameUI ui = (BasicInternalFrameUI)pInternalFrame.getUI();
 Container north = ui.getNorthPane();
 north.remove(0);
 north.validate();
 north.repaint();
 aTabbedPane.add(setTitle(pInternalFrame), pInternalFrame);
 int i = aTabs.size();
 aTabbedPane.setTabComponentAt(i,
            new ButtonTabComponent(this, pInternalFrame, aTabbedPane));
 aTabs.add(pInternalFrame);
 // position frame
 int emptySpace = FRAME_GAP * Math.max(ESTIMATED_FRAMES, frameCount);
 int width = Math.max(aTabbedPane.getWidth() / 2, aTabbedPane.getWidth() - emptySpace);            
 int height = Math.max(aTabbedPane.getHeight() / 2, aTabbedPane.getHeight() - emptySpace);

 pInternalFrame.reshape(frameCount * FRAME_GAP, frameCount * FRAME_GAP, width, height);
 pInternalFrame.show(); 
 int last = aTabs.size();
 aTabbedPane.setSelectedIndex(last-1);
 if(aTabbedPane.getComponentAt(0) instanceof WelcomeTab)
 {
  removeWelcomeTab();
 }

    }
项目:freecol    文件:Canvas.java   
/**
 * Adds a component on this Canvas inside a frame.
 *
 * @param comp The component to add to the canvas.
 * @param toolBox Should be set to true if the resulting frame is
 *     used as a toolbox (that is: it should not be counted as a
 *     frame).
 * @param popupPosition A preferred {@code PopupPosition}.
 * @param resizable Whether this component can be resized.
 * @return The {@code JInternalFrame} that was created and added.
 */
private JInternalFrame addAsFrame(JComponent comp, boolean toolBox,
                                  PopupPosition popupPosition,
                                  boolean resizable) {
    final int FRAME_EMPTY_SPACE = 60;

    final JInternalFrame f = (toolBox) ? new ToolBoxFrame()
        : new JInternalFrame();
    if (f.getContentPane() instanceof JComponent) {
        JComponent c = (JComponent) f.getContentPane();
        c.setOpaque(false);
        c.setBorder(null);
    }

    if (comp.getBorder() != null) {
        if (comp.getBorder() instanceof EmptyBorder) {
            f.setBorder(Utility.blankBorder(10, 10, 10, 10));
        } else {
            f.setBorder(comp.getBorder());
            comp.setBorder(Utility.blankBorder(5, 5, 5, 5));
        }
    } else {
        f.setBorder(null);
    }

    final FrameMotionListener fml = new FrameMotionListener(f);
    comp.addMouseMotionListener(fml);
    comp.addMouseListener(fml);
    if (f.getUI() instanceof BasicInternalFrameUI) {
        BasicInternalFrameUI biu = (BasicInternalFrameUI) f.getUI();
        biu.setNorthPane(null);
        biu.setSouthPane(null);
        biu.setWestPane(null);
        biu.setEastPane(null);
    }

    f.getContentPane().add(comp);
    f.setOpaque(false);
    f.pack();
    int width = f.getWidth();
    int height = f.getHeight();
    if (width > getWidth() - FRAME_EMPTY_SPACE) {
        width = Math.min(width, getWidth());
    }
    if (height > getHeight() - FRAME_EMPTY_SPACE) {
        height = Math.min(height, getHeight());
    }
    f.setSize(width, height);
    Point p = chooseLocation(comp, width, height, popupPosition);
    f.setLocation(p);
    this.add(f, MODAL_LAYER);
    f.setName(comp.getClass().getSimpleName());

    f.setFrameIcon(null);
    f.setVisible(true);
    f.setResizable(resizable);
    try {
        f.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {}

    return f;
}
项目:FreeCol    文件:Canvas.java   
/**
 * Adds a component on this Canvas inside a frame.
 *
 * @param comp The component to add to the canvas.
 * @param toolBox Should be set to true if the resulting frame is
 *     used as a toolbox (that is: it should not be counted as a
 *     frame).
 * @param popupPosition A preferred {@code PopupPosition}.
 * @param resizable Whether this component can be resized.
 * @return The {@code JInternalFrame} that was created and added.
 */
private JInternalFrame addAsFrame(JComponent comp, boolean toolBox,
                                  PopupPosition popupPosition,
                                  boolean resizable) {
    final int FRAME_EMPTY_SPACE = 60;

    final JInternalFrame f = (toolBox) ? new ToolBoxFrame()
        : new JInternalFrame();
    if (f.getContentPane() instanceof JComponent) {
        JComponent c = (JComponent) f.getContentPane();
        c.setOpaque(false);
        c.setBorder(null);
    }

    if (comp.getBorder() != null) {
        if (comp.getBorder() instanceof EmptyBorder) {
            f.setBorder(Utility.blankBorder(10, 10, 10, 10));
        } else {
            f.setBorder(comp.getBorder());
            comp.setBorder(Utility.blankBorder(5, 5, 5, 5));
        }
    } else {
        f.setBorder(null);
    }

    final FrameMotionListener fml = new FrameMotionListener(f);
    comp.addMouseMotionListener(fml);
    comp.addMouseListener(fml);
    if (f.getUI() instanceof BasicInternalFrameUI) {
        BasicInternalFrameUI biu = (BasicInternalFrameUI) f.getUI();
        biu.setNorthPane(null);
        biu.setSouthPane(null);
        biu.setWestPane(null);
        biu.setEastPane(null);
    }

    f.getContentPane().add(comp);
    f.setOpaque(false);
    f.pack();
    int width = f.getWidth();
    int height = f.getHeight();
    if (width > getWidth() - FRAME_EMPTY_SPACE) {
        width = Math.min(width, getWidth());
    }
    if (height > getHeight() - FRAME_EMPTY_SPACE) {
        height = Math.min(height, getHeight());
    }
    f.setSize(width, height);
    Point p = chooseLocation(comp, width, height, popupPosition);
    f.setLocation(p);
    this.add(f, MODAL_LAYER);
    f.setName(comp.getClass().getSimpleName());

    f.setFrameIcon(null);
    f.setVisible(true);
    f.setResizable(resizable);
    try {
        f.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {}

    return f;
}
项目:mars-sim    文件:ToolWindow.java   
/**
 * Constructor.
 * @param name the name of the tool
 * @param desktop the main desktop.
 */
public ToolWindow(String name, MainDesktopPane desktop) {

    // use JInternalFrame constructor
    super(
        name,
        true, // resizable
        true, // closable
        false, // maximizable
        false // iconifiable
    );

    // Initialize data members
    this.name = name;
    this.desktop = desktop;
    this.mainScene = desktop.getMainScene();

    // 2016-10-21 Remove title bar
    //putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
    getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    BasicInternalFrameUI bi = (BasicInternalFrameUI)super.getUI();
    bi.setNorthPane(null);
    setBorder(null);

    //getRootPane().setOpaque(false);
    //getRootPane().setBackground(new Color(0,0,0,128));
    //setOpaque(false);
    //setBackground(new Color(0,0,0,128));

    if (this instanceof MonitorWindow)
        this.monitorWindow = (MonitorWindow)this;

    opened = false;

    if (mainScene != null) {
        msm = mainScene.getMainSceneMenu();
        //ssm = mainScene.getJFXTabPane().getSelectionModel();
    }

    setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    //setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    // Set internal frame listener
    //ToolFrameListener tool = new ToolFrameListener(this);
    //addInternalFrameListener(tool);

    addInternalFrameListener(new ToolFrameListener());
}
项目:cn1    文件:JInternalFrameTest.java   
public void testSetGetUI() {
    BasicInternalFrameUI ui = new BasicInternalFrameUI(frame);
    frame.setUI(ui);
    assertTrue(frame.getUI() == ui);
}
项目:freeVM    文件:JInternalFrameTest.java   
public void testSetGetUI() {
    BasicInternalFrameUI ui = new BasicInternalFrameUI(frame);
    frame.setUI(ui);
    assertTrue(frame.getUI() == ui);
}
项目:freeVM    文件:JInternalFrameTest.java   
public void testSetGetUI() {
    BasicInternalFrameUI ui = new BasicInternalFrameUI(frame);
    frame.setUI(ui);
    assertTrue(frame.getUI() == ui);
}
项目:org.datagr4m    文件:LayeredDisplay.java   
protected void unwindowFrame(JInternalFrame frame){
    frame.setBorder(null);
    BasicInternalFrameUI biui = ((javax.swing.plaf.basic.BasicInternalFrameUI) frame.getUI());
    biui.setNorthPane(null);
}
项目:AgentWorkbench    文件:BasicGraphGuiRootJSplitPane.java   
/**
   * This method initializes this
   * @return void
   */
  private void initialize() {

this.setLayout(new BorderLayout());

((BasicInternalFrameUI) this.getUI()).setNorthPane(null);
this.setBorder(BorderFactory.createEmptyBorder());
this.setContentPane(this.getJSplitPaneRoot());
this.setNumberOfComponents();

this.setVisible(true);

  }