本文整理匯總了Java中javax.swing.JRootPane.getWindowDecorationStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java JRootPane.getWindowDecorationStyle方法的具體用法?Java JRootPane.getWindowDecorationStyle怎麽用?Java JRootPane.getWindowDecorationStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JRootPane
的用法示例。
在下文中一共展示了JRootPane.getWindowDecorationStyle方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: installBorder
import javax.swing.JRootPane; //導入方法依賴的package包/類
/**
* <p>給根窗格安裝邊框</p>
*
* <p>To install JRootPane border</p>
*
* @param root <code>JRootPane</code>
*/
protected void installBorder(JRootPane root)
{
int style = root.getWindowDecorationStyle();
// 這句必須,否則會出現無法安裝邊框的情況
// Sentence must, otherwise there will not be installed border situation
root.setBorder(null);
//
if(LuckPlatformUtils.isWindows())
{
root.setBorder(UIManager.getBorder(borderKeys[style]));
}
else
{
root.setBorder(LineBorder.createBlackLineBorder());
}
}
示例2: preferredLayoutSize
import javax.swing.JRootPane; //導入方法依賴的package包/類
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);
}
示例3: installUI
import javax.swing.JRootPane; //導入方法依賴的package包/類
@Override
public void installUI(JComponent c)
{
super.installUI(c);
JRootPane root = (JRootPane) c;
int style = root.getWindowDecorationStyle();
if (style != JRootPane.NONE)
{
installClientDecorations(root);
}
}
示例4: uninstallOther
import javax.swing.JRootPane; //導入方法依賴的package包/類
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));
}
}
示例5: installUI
import javax.swing.JRootPane; //導入方法依賴的package包/類
/**
* 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);
}
示例6: uninstallUI
import javax.swing.JRootPane; //導入方法依賴的package包/類
/**
* 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);
}
示例7: propertyChange
import javax.swing.JRootPane; //導入方法依賴的package包/類
/**
* 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);
}
}
示例8: mouseClicked
import javax.swing.JRootPane; //導入方法依賴的package包/類
/**
* 處理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);
}
}
}
}
}
示例9: mousePressed
import javax.swing.JRootPane; //導入方法依賴的package包/類
/**
* 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());
}
}
}
示例10: layoutContainer
import javax.swing.JRootPane; //導入方法依賴的package包/類
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);
}
示例11: propertyChange
import javax.swing.JRootPane; //導入方法依賴的package包/類
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);
}
}
}
示例12: installClientDecorations
import javax.swing.JRootPane; //導入方法依賴的package包/類
@Override
protected void installClientDecorations(JRootPane root)
{
super.installClientDecorations(root);
Window window = SwingUtilities.getWindowAncestor(root);
boolean isResize = LuckWindowUtil.isResizable(window);
int style = root.getWindowDecorationStyle();
installTitlePane(root, createTitlePanel(style, isResize), window);
}