FH-Hof Dialoge Richard Göbel. FH-Hof Inhalt JDialog Vordefinierte Dialoge File Browser.

Slides:



Advertisements
Similar presentations
Components and Containers
Advertisements

1 Event Listeners Some Events and Their Associated Event Listeners Act that Results in the EventListener Type User clicks a button, presses Enter while.
FH-Hof Auswahlmenüs Richard Göbel. FH-Hof Aufbau einer Menüleiste - Klassen JMenuBarJMenu JMenuItem.
1 Graphical User Interface (GUI) Applications Abstract Windowing Toolkit (AWT) Events Handling Applets.
Introduction to Swing Components Chapter 14. Part of the Java Foundation Classes (JFC) Provides a rich set of GUI components Used to create a Java program.
2I1073 Lektion 2 KTH-MI Peter Mozelius Servlets, säkerhet, och filhantering.
Graphical User Interfaces
JAVA1 1. JFrame. JAVA2 JApplet import java.awt.*; import java.awt.event.*; import javax.swing.*; public class HerhalingAppletH10 extends JApplet implements.
ตัวอย่างการพัฒนา ระบบงาน. 2 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SignInWindow extends JFrame { JPanel panel;
Computer Science 209 Images and GUIs. Working with Java Colors The class java.awt.Color includes constants, such as Color.red, for some commonly used.
Page w16.1 – Spring 2010Steffen Vissing Andersen SDJ I1 subjects, Spring 2010 Agenda – Week 16, 2010 GUI.
Gui Programming - II Teguh Sutanto, M.Kom.
Basic Java – Interface design. Understand: How to use TextPad for Java How to define classes and objects How to create a GUI interface How event-driven.
Graphical User Interfaces Java’s AWT and Swing APIs.
Graphical User Interfaces (Part IV)
Examples. // A simple Frame with Rectangle Inside import java.awt.*; import javax.swing.*; import java.awt.geom.*; // For Shapes class rectComponent extends.
Drawing in a frame – Java GUI
CS18000: Problem Solving and Object-Oriented Programming.
Unit 3 Graphical User Interface (GUI) Dr. Magdi AMER.
F27SB2 Programming Languages
Problem Solving 6 GUIs and Event Handling ICS-201 Introduction to Computing II Semester 071.
Multithreading : animation. slide 5.2 Animation Animation shows different objects moving or changing as time progresses. Thread programming is useful.
Graphical User Interface Bonus slides Interaction Between Components & Drawing.
Bar Graph Design. Left-side/Right-side mechanical processing creative, abstract reasoning.
Swing: the art of the GUI COMP204, Bernhard Pfahringer.
JAVA 程式語言入門 (II).  版面配置  事件驅動  Ch14_01.java 1. import javax.swing.*; 2. import java.awt.*; 3. class Ch14_01 4. { 5. public static void main(String.
Java Applets- Using SwingWorker Dave Price and Chris Loftus Computer Science Department University of Wales, Aberystwyth.
Introduction to Java Classes, events, GUI’s. Understand: How to use TextPad How to define a class or object How to create a GUI interface How event-driven.
Building Applications Dialogs Passing data between windows Validating Input using FocusListeners.
Deitel Ch 11-part 1 Java GUIs 1 Java GUIs (Deitel, Chap 14-part1) Focus: Attaching GUI components + event handling  input dialog => only one value for.
Java Swing Recitation – 11/(20,21)/2008 CS 180 Department of Computer Science, Purdue University.
CPSC150 Week 12 Graphical User Interfaces Chapter 11.
Java Swing 4 th April 2008 CS 180 Department of Computer Science, Purdue University.
Layout Mangers CSC 171 FALL 2001 LECTURE 14. History: The Transistor William Shockley, John Bardeen, and Walter Brattain invent the transfer resistance.
CC1007NI: Further Programming Week 5 Dhruba Sen Module Leader (Islington College)
F27SB2 Software Development 2 Lecture 9: Java GUIs 6.
Creating User Interfaces F JComponent F JButton F JLabel F JTextField F JTextArea F JComboBox F JList F JCheckBox F JRadioButton F Dialogs.
MIT AITI 2003 Lecture 17. Swing - Part II. The Java Event Model Up until now, we have focused on GUI's to present information (with one exception) Up.
1 Why layout managers Can we perform layout without them? –Yes. A container’s layout property can be set to null. Absolute positioning: specify size and.
GUI Clients 1 Enterprise Applications CE00465-M Clients with Graphical User Interfaces.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 25 – Ticket Information Application Introducing.
Programming with Java’s Swing API February 4, 2003 CMPS Advanced Programming Graphical User Interfaces.
Swing / Session1 / 1 of 30 Module Introduction Distributed Computing in Java.
Introduction to GUI in 1 Graphical User Interface 2 Nouf Almunyif.
Option Panes CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
GUI Graphical User Interface Each onscreen component and window is an object Object interaction makes communication and scoping challenging Event-driven.
1 Lecture 25 Listening to buttons and mice Quotes by Tony Hoare There are two ways of constructing a software design: (1) make it so simple that there.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 4 – Completing the Inventory Application.
1 Layout Managers Layout managers –Provided for arranging GUI components –Provide basic layout capabilities –Processes layout details –Programmer can concentrate.
Creating and Using Dialogs ● A dialog is a box that pops up and prompts the user for a value or informs them of something ● One way: directly create objects.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 17.1 Test-Driving the Student Grades Application.
MIT AITI 2004 Swing Event Model Lecture 17. The Java Event Model In the last lecture, we learned how to construct a GUI to present information to the.
제 14 장 고급 스윙 컴포넌트.
1 A Quick Java Swing Tutorial. 2 Introduction Swing – A set of GUI classes –Part of the Java's standard library –Much better than the previous library:
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 7.1 Test-Driving the Dental Payment Application.
Java Visual Applications CSIS 3701: Advanced Object Oriented Programming.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 7 ( Book Chapter 14) GUI and Event-Driven Programming.
A Quick Java Swing Tutorial
Modular Event Handling
GUI- Model-View-Controller
Graphical User Interface (pronounced "gooey")
A Quick Java Swing Tutorial
CSE 114 – Computer Science I Event Programming
MSIS670: Object-Oriented Software Engineering
JOptionPane Dialogs javax.swing.JOptionPane is a class for creating dialog boxes. Has both static methods and instance methods for dialogs. Easy to create.
Object-Oriented Software Engineering
CS18000: Problem Solving and Object-Oriented Programming
A Quick Java Swing Tutorial
Ch. No Name Marks 01 AWT Networking JDBC Swing 05
Ch. No Name Marks 01 AWT Networking JDBC Swing 05
Presentation transcript:

FH-Hof Dialoge Richard Göbel

FH-Hof Inhalt JDialog Vordefinierte Dialoge File Browser

FH-Hof Dialogboxen - Unterklasse von JDialog: Attribute public class TestDialog extends JDialog { private JPanel contentPane; private JPanel buttonPanel = new JPanel(); private JButton doneButton = new JButton("Done"); private JButton abortButton = new JButton("Abort"); private JTextField textfield = new JTextField(20);

FH-Hof Dialogboxen - Unterklasse von JDialog: Konstruktor public TestDialog (Frame owner, String title) { super(owner, "TestDialog", true); // Modal! contentPane = (JPanel) getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.add(textfield); contentPane.add(buttonPanel); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(doneButton); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(abortButton);... pack(); }

FH-Hof Dialogboxen - Unterklasse von JDialog: Listener abortButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {... hier die Aktion... setVisible(false); } }); doneButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {... hier die Aktion... setVisible(false); } });

FH-Hof Vordefinierte Dialoge - Beispiel JOptionPane pane = new JOptionPane(); String sName = JOptionPane.showInputDialog("Name eingeben:");

FH-Hof Vordefinierte Dialoge - weitere Möglichkeiten showConfirmDialog(Component parentComponent, Object message) showInputDialog(Component parentComponent, Object message) showMessageDialog(Component parentComponent, Object message, String title, int messageType) showOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)

FH-Hof File Browser - Darstellung

FH-Hof File Browser - Datei laden File file; JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(getContentPane()); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); System.err.println("Loading: " + file.getName()); } else { System.err.println("Open command cancelled"); }

FH-Hof File Browser - Datei Speichern File file; JFileChooser fc = new JFileChooser(); int returnVal = fc.showSaveDialog(getContentPane()); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); System.err.println("Saving: " + file.getName()); } else { System.err.println("Open command cancelled"); }

FH-Hof JTreeModel Zeichenkette Objekt Zeichenkette Objekt Aufbau eines JTree - Klassen DefaultMutableTreeNode JTree