本文整理汇总了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);
}