本文整理匯總了Java中javax.swing.JRootPane.NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java JRootPane.NONE屬性的具體用法?Java JRootPane.NONE怎麽用?Java JRootPane.NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.swing.JRootPane
的用法示例。
在下文中一共展示了JRootPane.NONE屬性的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
{
Insets insets = parent.getInsets();
JRootPane root = (JRootPane) parent;
int h = 0;
Dimension cpd = null;
if (root.getContentPane() != null)
{
cpd = root.getContentPane().getPreferredSize();
if (!(root.getContentPane() instanceof LuckBackgroundPanel)
&& root.getWindowDecorationStyle() != JRootPane.NONE)
{
h += UIManager.getInt(LuckRootPaneUIBundle.TITLEPANEL_HEIGHT);
}
}
else
{
cpd = root.getSize();
}
h += cpd.height;
return getDimension(insets, cpd.width, h);
}
示例2: installUI
@Override
public void installUI(JComponent c)
{
super.installUI(c);
JRootPane root = (JRootPane) c;
int style = root.getWindowDecorationStyle();
if (style != JRootPane.NONE)
{
installClientDecorations(root);
}
}
示例3: uninstallOther
protected void uninstallOther(JRootPane root)
{
Container content = root.getContentPane();
if (content != null && content instanceof LuckBackgroundPanel)
{
LuckBackgroundPanel bgPanel = (LuckBackgroundPanel) content;
root.setContentPane(bgPanel.getContentPane());
root.setJMenuBar(bgPanel.getJMenuBar());
bgPanel.uninstallMenubar(true);
}
int style = root.getWindowDecorationStyle();
if (style == JRootPane.NONE)
{
root.repaint();
root.revalidate();
}
Window window = SwingUtilities.getWindowAncestor(root);
if (window != null)
{
window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
示例4: preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
{
Insets insets = parent.getInsets();
LuckBackgroundPanel baPanel = (LuckBackgroundPanel) parent;
int h = 0;
if (baPanel.getRootPane() != null && JRootPane.NONE != baPanel
.getRootPane().getWindowDecorationStyle())
{
Dimension titleDm = baPanel.getTitlePanel().getPreferredSize();
h += titleDm.height;
}
if (baPanel.getJMenuBar() != null && baPanel.getJMenuBar().isVisible())
{
Dimension menuBarDm = baPanel.getRootPane().getJMenuBar().getPreferredSize();
h += menuBarDm.height;
}
Dimension contentDm = baPanel.getContentPane().getPreferredSize();
h += contentDm.height;
return getDimension(insets, contentDm.width, h);
}
示例5: minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)
{
Insets insets = parent.getInsets();
LuckBackgroundPanel baPanel = (LuckBackgroundPanel) parent;
int h = 0;
if (JRootPane.NONE != baPanel.getRootPane().getWindowDecorationStyle())
{
Dimension titleDm = baPanel.getTitlePanel().getMinimumSize();
h += titleDm.height;
}
if (baPanel.getRootPane().getJMenuBar() != null
&& baPanel.getRootPane().getJMenuBar().isVisible())
{
Dimension menuBarDm = baPanel.getRootPane().getJMenuBar().getMinimumSize();
h += menuBarDm.height;
}
Dimension contentDm = baPanel.getContentPane().getMinimumSize();
h += contentDm.height;
return getDimension(insets, contentDm.width, h);
}
示例6: maximumLayoutSize
public Dimension maximumLayoutSize(Container parent)
{
Insets insets = parent.getInsets();
LuckBackgroundPanel baPanel = (LuckBackgroundPanel) parent;
int h = 0;
if (JRootPane.NONE != baPanel.getRootPane().getWindowDecorationStyle())
{
Dimension titleDm = baPanel.getTitlePanel().getMaximumSize();
h += titleDm.height;
}
if (baPanel.getRootPane().getJMenuBar() != null
&& baPanel.getRootPane().getJMenuBar().isVisible())
{
Dimension menuBarDm = baPanel.getRootPane().getJMenuBar().getMaximumSize();
h += menuBarDm.height;
}
Dimension contentDm = baPanel.getContentPane().getMaximumSize();
h += contentDm.height;
return getDimension(insets, contentDm.width, h);
}
示例7: installUI
/**
* Installs this UI to the root pane. If the
* <code>windowDecorationsStyle</code> property is set on the root pane,
* the Metal window decorations are installed on the root pane.
*
* @param c
*/
public void installUI(JComponent c)
{
super.installUI(c);
JRootPane rp = (JRootPane) c;
if (rp.getWindowDecorationStyle() != JRootPane.NONE)
installWindowDecorations(rp);
}
示例8: uninstallUI
/**
* Uninstalls the UI from the root pane. This performs the superclass
* behaviour and uninstalls the window decorations that have possibly been
* installed by {@link #installUI}.
*
* @param c the root pane
*/
public void uninstallUI(JComponent c)
{
JRootPane rp = (JRootPane) c;
if (rp.getWindowDecorationStyle() != JRootPane.NONE)
uninstallWindowDecorations(rp);
super.uninstallUI(c);
}
示例9: propertyChange
/**
* Receives notification if any of the JRootPane's property changes. In
* particular this catches changes to the <code>windowDecorationStyle</code>
* property and installs the window decorations accordingly.
*
* @param ev the property change event
*/
public void propertyChange(PropertyChangeEvent ev)
{
super.propertyChange(ev);
String propertyName = ev.getPropertyName();
if (propertyName.equals("windowDecorationStyle"))
{
JRootPane rp = (JRootPane) ev.getSource();
if (rp.getWindowDecorationStyle() != JRootPane.NONE)
installWindowDecorations(rp);
else
uninstallWindowDecorations(rp);
}
}
示例10: mouseClicked
/**
* 處理JFrame的雙擊標題麵板縮放事件
*/
public void mouseClicked(MouseEvent e)
{
Window window = (Window) e.getSource();
if(window instanceof JFrame)
{
JFrame frame = (JFrame) window;
JRootPane root = frame.getRootPane();
// 不包含窗體裝飾直接返回
if (root.getWindowDecorationStyle() == JRootPane.NONE)
{
return;
}
// 不在標題欄覆蓋區域直接返回
if(!titleArea.contains(e.getPoint()))
{
return;
}
if ((e.getClickCount() % 2) == 0 && ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0))
{
int state = frame.getExtendedState();
if (frame.isResizable())
{
if ((state & JFrame.MAXIMIZED_BOTH) != 0)
{
frame.setExtendedState(state & ~JFrame.MAXIMIZED_BOTH);
}
else
{
frame.setExtendedState(state | JFrame.MAXIMIZED_BOTH);
}
}
}
}
}
示例11: mousePressed
/**
* v1.0.1:修複自定義拖拽區域BUG, 增加邊界判斷
*/
public void mousePressed(MouseEvent e)
{
Window window = (Window) e.getSource();
JRootPane root = LuckWindowUtil.getRootPane(window);
// 不包含窗體裝飾直接返回
if (root == null || root.getWindowDecorationStyle() == JRootPane.NONE)
{
return;
}
if (window != null)
{
window.toFront();
}
// 如果是單擊標題欄, 則標記接下來的拖動事件為移動窗口, 判斷當前鼠標是否超出邊界
if (dragArea.contains(e.getPoint())
&& dragCursor == Cursor.DEFAULT_CURSOR)
{
if(window instanceof JFrame)
{
JFrame frame = (JFrame)window;
// 如果當前窗體是全屏狀態則直接返回
if(frame.getExtendedState() == JFrame.MAXIMIZED_BOTH)
{
return;
}
}
// 設置為可以移動並記錄當前坐標
isMovingWindow = true;
dragOffsetX = e.getPoint().x;
dragOffsetY = e.getPoint().y;
}
else if(LuckWindowUtil.isResizable(window))
{
dragOffsetX = e.getPoint().x;
dragOffsetY = e.getPoint().y;
dragWidth = window.getWidth();
dragHeight = window.getHeight();
JRootPane rootPane = LuckWindowUtil.getRootPane(window);
if(rootPane != null && LuckWindowUtil.isResizable(window))
{
dragCursor = getCursor(dragWidth, dragHeight, e.getPoint(), rootPane.getInsets());
}
}
}
示例12: layoutContainer
public void layoutContainer(Container parent)
{
JRootPane root = (JRootPane) parent;
Rectangle bound = root.getBounds();
Insets inset = root.getInsets();
// 獲取內容麵板實際寬度, 減去左右邊框麵積
// Calculate the actual width
int w = bound.width - inset.right - inset.left;
// 獲取內容麵板實際高度, 減去上下邊框麵積
int h = bound.height - inset.top - inset.bottom;
// 設置層級麵板在根窗格中的位置
// Calculate the actual height
if(root.getLayeredPane() != null)
{
root.getLayeredPane().setBounds(inset.left, inset.top, w, h);
}
// 布局玻璃窗格
// layout LayeredPane
if(root.getGlassPane() != null)
{
root.getGlassPane().setBounds(inset.left, inset.top, w, h);
}
// 獲取當前內容麵板
// get current ContentPane
Container content = root.getContentPane();
LuckRootPaneUI rootPaneUI = (LuckRootPaneUI) root.getUI();
// 使用 <code>LuckBackgroundPanel</code>替換當前的內容麵板
// Use <code>LuckBackgroundPanel</code> replace the current contents of the panel
if(!(content instanceof LuckBackgroundPanel))
{
Window window = SwingUtilities.getWindowAncestor(root);
boolean isResizeableOnInit = LuckWindowUtil.isResizable(window);
int initStyle = root.getWindowDecorationStyle();
if(initStyle != JRootPane.NONE)
{
//
LuckTitlePanel titlePanel = rootPaneUI.createTitlePanel(initStyle, isResizeableOnInit);
LuckBackgroundPanel background = rootPaneUI.createContentPane(titlePanel, content);
root.setContentPane(background);
}
}
root.getContentPane().setBounds(0, 0, w, h);
}
示例13: propertyChange
public void propertyChange(PropertyChangeEvent e)
{
super.propertyChange(e);
String propertyName = e.getPropertyName();
if (propertyName == null)
{
return;
}
JRootPane root = (JRootPane) e.getSource();
Container parent = root.getParent();
if (!(parent instanceof Window))
{
return;
}
if (WINDOWDECORATIONSTYLE_EVENT.equals(propertyName))
{
int style = root.getWindowDecorationStyle();
uninstallClientDecorations(root);
if (style != JRootPane.NONE)
{
installClientDecorations(root);
}
}
else if (ANCESTOR_EVENT.equals(propertyName))
{
uninstallWindowListener(root);
if (((JRootPane) e.getSource()).getWindowDecorationStyle() != JRootPane.NONE)
{
installWindowListeners(root);
}
}
}
示例14: layoutContainer
public void layoutContainer(Container parent)
{
LuckBackgroundPanel root = (LuckBackgroundPanel) parent;
Rectangle bound = root.getBounds();
Insets inset = root.getInsets();
// 計算內容麵板實際寬度, 減去左右邊框麵積
// Calculate the actual width
int w = bound.width - inset.right - inset.left;
// 計算內容麵板實際高度, 減去上下邊框麵積
// Calculate the actual height
int h = bound.height - inset.top - inset.bottom;
int nextY = inset.top;
// 避免無用的繪製
// avoid useless draw
if (w <= 0 || h <= 0)
{
return;
}
// 布局標題麵板
// layout title panel
LuckTitlePanel titlePanel = root.getTitlePanel();
// 計算標題麵板的高度,和下一個麵板的起始y坐標
// Calculate the height of the title of the panel, and a panel at the
// start of the y coordinate
if (root.getRootPane() != null && titlePanel != null
&& JRootPane.NONE != root.getRootPane().getWindowDecorationStyle())
{
titlePanel.setBounds(inset.left, inset.top, w, titlePanel.getHeight());
nextY += titlePanel.getHeight();
}
// 布局JMenuBar
// layout JMenuBar
JMenuBar menuBar = root.getRootPane().getJMenuBar();
if(menuBar != null && menuBar.isVisible())
{
root.installJMenubar(menuBar);
menuBar.setBounds(inset.left, nextY, w, menuBar.getPreferredSize().height);
nextY += menuBar.getPreferredSize().getHeight();
}
//
if(menuBar == null || !menuBar.isVisible())
{
root.uninstallMenubar(menuBar == null);
}
// 布局內容麵板
// layout contentPane
Container contentPane = root.getContentPane();
contentPane.setBounds(inset.left, nextY, w, h - nextY);
}