|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.utils.PortingUtils
public class PortingUtils
A class that keeps all 1.4/1.3 different stuff.
Field Summary | |
---|---|
static boolean |
INITIALIZE_SCREEN_AREA_USING_THREAD
|
Constructor Summary | |
---|---|
PortingUtils()
|
Method Summary | |
---|---|
static Rectangle |
containsInScreenBounds(Component invoker,
Rectangle rect)
To make sure the rectangle is within the screen bounds. |
static Rectangle |
containsInScreenBounds(Component invoker,
Rectangle rect,
boolean useInvokerDevice)
To make sure the rectangle is within the screen bounds. |
static Rectangle |
ensureOnScreen(Rectangle rect)
Modifies the position of rect so that it is completely on screen if that is possible. |
static Rectangle |
ensureVisible(Component invoker,
Rectangle bounds)
Ensures the rectangle is visible on the screen. |
static Rectangle |
getContainingScreenBounds(Rectangle rect,
boolean considerInsets)
Gets the screen bounds that contains the rect. |
static Component |
getCurrentFocusComponent(AWTEvent event)
Gets current focused components. |
static int |
getFrameState(Frame frame)
Gets frame's state. |
static Rectangle |
getLocalScreenBounds()
Gets the local monitor's screen bounds. |
static Dimension |
getLocalScreenSize(Component invoker)
Gets the screen size. |
static int |
getMouseModifiers(MouseEvent e)
Gets mouse modifiers. |
static Area |
getScreenArea()
Get screen area of all monitors. |
static Rectangle |
getScreenBounds(Component invoker)
Gets the screen bounds. |
static Rectangle |
getScreenBounds(Component invoker,
boolean useInvokerDevice)
Gets the screen bounds. |
static Dimension |
getScreenSize(Component invoker)
Gets the screen size. |
static void |
initializeScreenArea()
If you use methods such as ensureOnScreen(java.awt.Rectangle) , getContainingScreenBounds(java.awt.Rectangle,boolean) or getScreenArea() for the first time, it will
take up to a few seconds to run because it needs to get device information. |
static void |
initializeScreenArea(int priority)
If you use methods such as ensureOnScreen(java.awt.Rectangle) , getContainingScreenBounds(java.awt.Rectangle,boolean) or getScreenArea() for the first time, it will
take up to a couple of seconds to run because it needs to get device information. |
static boolean |
isInitalizationThreadStarted()
|
static boolean |
isInitializationThreadAlive()
|
static void |
notifyUser()
Notifies user something is wrong. |
static void |
notifyUser(Component component)
Notifies user something is wrong. |
static Rectangle |
overlapWithScreenBounds(Component invoker,
Rectangle rect)
To make sure the rectangle has overlap with the screen bounds. |
static void |
prerequisiteChecking()
Checks the prerequisite needed by JIDE demos. |
static void |
removeButtonBorder(AbstractButton button)
Removes the button border. |
static void |
removeFocus(JComponent component)
Makes sure the component won't receive the focus. |
static void |
setFrameState(Frame frame,
int state)
Sets frame's state. |
static void |
setMinimumSize(Component component,
Dimension size)
Sets the minimum size on a component. |
static void |
setPreferredSize(Component component,
Dimension size)
Sets the preferred size on a component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean INITIALIZE_SCREEN_AREA_USING_THREAD
Constructor Detail |
---|
public PortingUtils()
Method Detail |
---|
public static Component getCurrentFocusComponent(AWTEvent event)
event
- the AWT event
public static int getFrameState(Frame frame)
frame
- the frame
public static void setFrameState(Frame frame, int state)
frame
- the framestate
- the statepublic static int getMouseModifiers(MouseEvent e)
e
- the mouse event
public static void removeFocus(JComponent component)
component
- the componentpublic static void removeButtonBorder(AbstractButton button)
button
- the buttonpublic static Rectangle containsInScreenBounds(Component invoker, Rectangle rect)
invoker
- the invoker componentrect
- the rectangle
public static Rectangle containsInScreenBounds(Component invoker, Rectangle rect, boolean useInvokerDevice)
invoker
- the invoker componentrect
- the rectangleuseInvokerDevice
- the flag to return invoker device or not
public static Rectangle overlapWithScreenBounds(Component invoker, Rectangle rect)
invoker
- the invoker componentrect
- the rectangle
public static Dimension getScreenSize(Component invoker)
invoker
- the invoker component
public static Dimension getLocalScreenSize(Component invoker)
invoker
- the invoker component
public static Rectangle getScreenBounds(Component invoker, boolean useInvokerDevice)
invoker
- the invoker componentuseInvokerDevice
- the flag to return invoker device or not
public static Rectangle getScreenBounds(Component invoker)
invoker
- the invoker component
getScreenBounds(java.awt.Component, boolean)
public static Rectangle getLocalScreenBounds()
public static void initializeScreenArea()
ensureOnScreen(java.awt.Rectangle)
, getContainingScreenBounds(java.awt.Rectangle,boolean)
or getScreenArea()
for the first time, it will
take up to a few seconds to run because it needs to get device information. To avoid any slowness, you can call call this method in the class where you will use those three methods. This method
will spawn a thread to retrieve device information thus it will return immediately. Hopefully, when you use the three methods, the thread is done so user will not notice any slowness.
public static void initializeScreenArea(int priority)
ensureOnScreen(java.awt.Rectangle)
, getContainingScreenBounds(java.awt.Rectangle,boolean)
or getScreenArea()
for the first time, it will
take up to a couple of seconds to run because it needs to get device information. To avoid any slowness, you can call initializeScreenArea()
method in the class where you will use
those three methods. This method will spawn a thread to retrieve device information thus it will return immediately. Hopefully, when you use the three methods, the thread is done so user will
not notice any slowness.
priority
- as we will use a thread to calculate the screen area, you can use this parameter to control the priority of the thread. If you are waiting for the result before the next step,
you should use normal priority (which is 5). If you just want to calculate when app starts, you can use a lower priority (such as 3). For example, AbstractComboBox needs screen
size so that the popup doesn't go beyond the screen. So when AbstractComboBox is used, we will kick off the thread at priority 3. If user clicks on the drop down after the
thread finished, there will be no time delay.public static boolean isInitializationThreadAlive()
public static boolean isInitalizationThreadStarted()
public static Rectangle ensureVisible(Component invoker, Rectangle bounds)
invoker
- the invoking componentbounds
- the input bounds
public static Rectangle ensureOnScreen(Rectangle rect)
rect
- Therectanglee to move onto a single screen
public static Rectangle getContainingScreenBounds(Rectangle rect, boolean considerInsets)
rect
- the rect of the component.considerInsets
- if consider the insets. The insets is for thing like Windows Task Bar.
public static Area getScreenArea()
public static void notifyUser()
public static void notifyUser(Component component)
component
- the component that has the error or null if the error is not associated with any component.public static void prerequisiteChecking()
public static void setPreferredSize(Component component, Dimension size)
component
- the componentsize
- the preferred size.public static void setMinimumSize(Component component, Dimension size)
component
- the componentsize
- the preferred size.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |