byte[] bytes = str.getBytes();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
Wednesday, January 19, 2005
Thursday, January 13, 2005
How to have a page start from the top of the browser window, and occupy entire height of the browser
Using XTHML and CSS:
html, body {
height: 100%;
margin: 0;
padding: 0;
}
table {
height: 100%;
width: 100%;
background-color: #CCC;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
table {
height: 100%;
width: 100%;
background-color: #CCC;
}
avoid JDialog from being hidden when user switches to another application window
Common frustration with Java. Your child dialogs seem to disappear if you switch to another application window and come back. The only way to switch to the dialog box seems to be thru the task switching function ( Alt+Tab )
Actually, that only happens when you pass null to the constructor of JDialog. If you pass the parent frame's reference to the JDialog constructor, the jdialog is automatically made visibile when the user returns to your application.
Actually, that only happens when you pass null to the constructor of JDialog. If you pass the parent frame's reference to the JDialog constructor, the jdialog is automatically made visibile when the user returns to your application.
Tuesday, January 11, 2005
Setting cursor for entire application
The secret is that you have to change the cursor on theoriginating component AND on its frame!Here's a little code snippet (part of a static utility class) that does the job :
public class Util {
public static void doWaitCursor (Component component) {
setCursor(Cursor.WAIT_CURSOR, component);
}
public static void noWaitCursor (Component component) {
setCursor(Cursor.DEFAULT_CURSOR, component);
}
public static void setCursor (int cursor, Component component) {
component.setCursor(Cursor.getPredefinedCursor(cursor));
Frame frame = getFrame(component);
if (frame != null)
frame.setCursor(Cursor.getPredefinedCursor(cursor));
}
public static Frame getFrame (Component c) {
if (c instanceof Frame)
return (Frame) c;
while ((c = c.getParent()) != null)
if (c instanceof Frame)
return (Frame) c;
return null;
}
}
Source: http://forum.java.sun.com/thread.jspa?threadID=111793&messageID=296338
public class Util {
public static void doWaitCursor (Component component) {
setCursor(Cursor.WAIT_CURSOR, component);
}
public static void noWaitCursor (Component component) {
setCursor(Cursor.DEFAULT_CURSOR, component);
}
public static void setCursor (int cursor, Component component) {
component.setCursor(Cursor.getPredefinedCursor(cursor));
Frame frame = getFrame(component);
if (frame != null)
frame.setCursor(Cursor.getPredefinedCursor(cursor));
}
public static Frame getFrame (Component c) {
if (c instanceof Frame)
return (Frame) c;
while ((c = c.getParent()) != null)
if (c instanceof Frame)
return (Frame) c;
return null;
}
}
Source: http://forum.java.sun.com/thread.jspa?threadID=111793&messageID=296338
Subscribe to:
Posts (Atom)