1 / 12

Exploring Java UI Toolkits: AWT, Swing, JavaFX, and SWT

This guide provides an overview of Java user interface toolkits, including AWT, Swing, JavaFX, and SWT (Eclipse). It delves into the Look and Feel options available, such as Cross Platform Look and Feel, System Look and Feel, and Synth Look and Feel (Nimbus). The document also outlines example code snippets demonstrating how to set different Looks using UIManager, handling exceptions, and creating a simple "Hello, World!" application with Swing components. A concise exploration for developers looking to enhance their Java UI knowledge.

onaona
Télécharger la présentation

Exploring Java UI Toolkits: AWT, Swing, JavaFX, and SWT

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. User interface

  2. Widget toolkits • AWT • Swing • JavaFX • SWT (Eclipse) • ...

  3. AWT and Swing

  4. Look&Feel • CrossPlatformLookAndFeel • SystemLookAndFeel (Windows, Motif/GTK) • Synth (Nimbus)

  5. Look&Feel try { UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel"); // UIManager.setLookAndFeel( // UIManager.getSystemLookAndFeelClassName()); // SwingUtilities.updateComponentTreeUI(this); } catch (Exception e){ //Exception handle }

  6. JTable Demo Metal

  7. JTable Demo Nimbus

  8. JTable Demo Windows

  9. Hello, World! import javax.swing.*; public final class HelloWorld implements Runnable { public static void main(String[] args) { SwingUtilities.invokeLater(new HelloWorld()); } public void run() { JFrame f = new JFrame("Hello, World!"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new JLabel("Hello World")); f.pack(); f.setVisible(true); } }

  10. AWT Layout managers

  11. Swing Layout managers

  12. Q&A

More Related