Use the following DatabaseMetaData methods: * getDriverMajorVersion() * getDriverMinorVersion() * getDriverName() * getDriverVersion()
Filed under: JDBC, JDBC | Leave a Comment »
Use the following DatabaseMetaData methods: * getDriverMajorVersion() * getDriverMinorVersion() * getDriverName() * getDriverVersion()
Filed under: JDBC, JDBC | Leave a Comment »
The JDBC is used whenever a Java application should communicate with a relational database for which a JDBC driver exists. JDBC is part of the Java platform standard; all visible classes and interfaces used in the JDBC are placed in package Java Main JDBC classes: * DriverManager. Manages a list of database [...]
Filed under: JDBC, JDBC | Leave a Comment »
The Swing text components come with built in support for undoing and redoing text operations. All you have to do is associate an UndoManager to the Document of the text component: JTextField textField = new JTextField(); UndoManager manager = new UndoManager(); Document document = textField.getDocument(); document.addUndoableEditListener(manager); Then, when it comes time to [...]
Filed under: Applets, AWT and Swing | Leave a Comment »
You can include HTML content in tooltip text as follows: setToolTipText(“<html>This is the first line<br>This is the second line</html>”);
Filed under: Applets, AWT and Swing | Leave a Comment »
You can validate the data in any of the three location * As the user types characters Register a DocumentListener with the JTextField and validate data in the events of DocumentListener. * After the user is done with the field You need to register listeners for: Focus change (leaving the [...]
Filed under: Applets, AWT and Swing | Leave a Comment »
When you run a GUI applet or application, the code in your main() method creates a GUI and sets up event handling. When you call setVisible(true) for your Frame, Window, Dialog, or when the browser displays the Applet, the user must be able to interact with the GUI. The problem is that your main() [...]
Filed under: Applets, AWT and Swing | Leave a Comment »
To ensure a specific row (or cell) is visible, you need to get the rectangle surrounding a specific row/column (cell) than make sure that is visible: Rectangle rect = table.getCellRect(row, column, true); table.scrollRectToVisible(rect);
Filed under: Applets, AWT and Swing | Leave a Comment »
You can either call the setLookAndFeel() method of the UIManager class or set the swing.defaultlaf property of your Java program before it starts. If you wish to change the look and feel of a running program, you will need to call the updateComponentTreeUI() method of the SwingUtilities class to update each top-level window. [...]
Filed under: Applets, AWT and Swing | Leave a Comment »
Call Frame.getFrames() which will return all frames created by the application. Frame[] f = Frame.getFrames(); Frame active = null; for (int i = 0; i < f.lenght; i++) { if (f[i].isActive()) { active = f[i]; break; } }
Filed under: Applets, AWT and Swing | Leave a Comment »
SWT (Standard Widget Toolkit) is a completely independent Graphical User Interface (GUI) toolkit from IBM. They created it for their new Eclipse Integrated Development Environment (IDE). IBM began work on SWT a few years ago, because Swing was still immature and didn’t perform well. They decided to create a new toolkit to provide better [...]
Filed under: Applets, AWT and Swing | Leave a Comment »