Agenda. 1. Abstract Windowing Toolkit (AWT) 2. Event Handling 3. Swing 4. Layout Manager 5. Applet
|
|
- Annis Bradford
- 5 years ago
- Views:
Transcription
1 Core Java (Part-2)
2 Agenda 1. Abstract Windowing Toolkit (AWT) 2. Event Handling 3. Swing 4. Layout Manager 5. Applet 2
3 Abstract Windowing Toolkit (AWT) Abstract Windowing Toolkit (AWT) is used for GUI programming in java. AWT Container Hierarchy: 3
4 Container: The Container is a component in AWT that can contain another components like buttons, textfields, labels etc. The classes that extends Container class are known as container. Window: The window is the container that have no borders and menubars. You must use frame, dialog or another window for creating a window. Panel: The Panel is the container that doesn't contain title bar and MenuBars. It can have other components like button, textfield etc. Frame: The Frame is the container that contain title bar and can have MenuBars. It can have other components like button, textfield etc. 4
5 Creating a Frame Commonly used Methods of Component class: 1)public void add(component c) 2)public void setsize(int width,int height) 3)public void setlayout(layoutmanager m) 4)public void setvisible(boolean) Creating a Frame: There are two ways to create a frame: By extending Frame class (inheritance) By creating the object of Frame class (association) 5
6 Creating a Frame: Set Button Simple example of AWT by inheritance: import java.awt.*; class First extends Frame{ First(){ Button b=new Button("click me"); b.setbounds(30,100,80,30);// setting button position add(b);//adding button into frame setsize(300,300);//frame size 300 width and 300 height setlayout(null);//no layout now bydefault BorderLayout setvisible(true);//now frame willbe visible, bydefault not visible } public static void main(string args[]){ First f=new First(); } } 6
7 Button public void setbounds(int xaxis, int yaxis, int width, int height); have been used in the above example that sets the position of the button. 7
8 Event and Listener (Event Handling) Changing the state of an object is known as an event. For example, click on button, dragging mouse etc. The java.awt.event package provides many event classes and Listener interfaces for event handling. Event classes and Listener interfaces Event Classes Listener Interfaces ActionEvent ActionListener MouseEvent MouseListener MouseMotionListener MouseWheelEvent MouseWheelListener KeyEvent KeyListener ItemEvent ItemListener 8
9 Event classes and Listener interfaces Event Classes Listener Interfaces TextEvent TextListener AdjustmentEvent AdjustmentListener WindowEvent WindowListener ComponentEvent ComponentListener ContainerEvent ContainerListener FocusEvent FocusListener Steps to perform EventHandling: Implement the Listener interface and overrides its methods Register the component with the Listener 9
10 Steps to perform EventHandling For registering the component with the Listener, many classes provide methods. F Button public void addactionlistener(actionlistener a){} MenuItem public void addactionlistener(actionlistener a){} TextField public void addactionlistener(actionlistener a){} public void addtextlistener(textlistener a){} TextArea public void addtextlistener(textlistener a){} Checkbox public void additemlistener(itemlistener a){} 10
11 EventHandling Codes Choice public void additemlistener(itemlistener a){} List public void addactionlistener(actionlistener a){} public void additemlistener(itemlistener a){} EventHandling Codes: We can put the event handling code into one of the following places: Same class Other class Annonymous class 11
12 Example of event handling within class import java.awt.*; import java.awt.event.*; class AEvent extends Frame implements ActionListener{ TextField tf; AEvent(){ tf=new TextField(); tf.setbounds(60,50,170,20); Button b=new Button("click me"); b.setbounds(100,120,80,30); b.addactionlistener(this); add(b);add(tf); setsize(300,300); setlayout(null); setvisible(true); } public void actionperformed(actionevent e){ tf.settext("welcome"); } public static void main(string args[]){ new AEvent(); } } 12
13 Output public void setbounds(int xaxis, int yaxis, int width, int height); have been used in the above example that sets the position of the component it may be button, textfield etc. 13
14 Example of event handling by Outer class import java.awt.*; import java.awt.event.*; class AEvent2 extends Frame implements ActionListener{ TextField tf; AEvent2(){ tf=new TextField(); tf.setbounds(60,50,170,20); Button b=new Button("click me"); b.setbounds(100,120,80,30); b.addactio nlistener(this); add(b);add(tf); setsize(300,300); setlayout(null); setvisible(true); } public void actionperformed(actionevent e){ tf.settext("welcome"); } public static void main(string args[]){ new AEvent2(); } } 14
15 Outer class import java.awt.event.*; class Outer implements ActionListener{ AEvent2 obj; Outer(AEvent2 obj){ this.obj=obj; } public void actionperformed(actionevent e){ obj.tf.settext("welcome"); } } 15
16 Example of event handling by Annonymous class import java.awt.*; import java.awt.event.*; class AEvent3 extends Frame{ TextField tf; AEvent3(){ tf=new TextField(); tf.setbounds(60,50,170,20); Button b=new Button("click me"); b.setbounds(50,120,80,30); b.addactionlistener(new ActionListener(){ public void actionperformed(){ tf.settext("hello"); } }); add(b); add(tf); setsize(300,300); setlayout(null); setvisible(true); } public static void main(string args[]) { new AEvent3(); } } 16
17 Swing (Graphics Programming in java) Swing is a part of JFC (Java Foundation Classes) that is used to create GUI application. It is built on the top of Swing is a part of JFC (Java Foundation Classes) that is used to create GUI application. It is built on the top of AWT and entirely written in java. Advantage of Swing over AWT: There are many advantages of Swing over AWT. They are as follows: Swing components are Plateform independent & It is lightweight. It supports pluggable look and feel. It has more powerful componenets like tables, lists, scroll panes, color chooser, tabbed pane etc. It follows MVC (Model View Controller) architecture. What is JFC? - The Java Foundation Classes (JFC) are a set of GUI components which simplify the development of desktop applications. 17
18 Hierarchy of swing 18
19 Commonly used Methods of Component class Commonly used Methods of Component class: 1)public void add(component c) 2)public void setsize(int width,int height) 3)public void setlayout(layoutmanager m) 4)public void setvisible(boolean) Creating a Frame: There are two ways to create a frame: By creating the object of Frame class (association) By extending Frame class (inheritance) 19
20 Simple example of Swing by Association import javax.swing.*; public class Simple { JFrame f; Simple(){ f=new JFrame(); JButton b=new JButton("click"); b.setbounds(130,100,100, 40); f.add(b); f.setsize(400,500); f.setlayout(null); f.setvisible(true); } public static void main(string[] args) { new Simple(); } } 20
21 Output public void setbounds(int xaxis, int yaxis, int width, int height); have been used in the above example that sets the position of the button. 21
22 Button class The JButton class is used to create a button that have plateform-independent implementation. Commonly used Constructors: JButton(): creates a button with no text and icon. JButton(String s): creates a button with the specified text. JButton(Icon i): creates a button with the specified icon object. Commonly used Methods of AbstractButton class: 1) public void settext(string s): is used to set specified text on button. 2) public String gettext(): is used to return the text of the button. 3) public void setenabled(boolean b): is used to enable or disable the button. 4) public void seticon(icon b): is used to set the specified Icon on the button. 5) public Icon geticon(): is used to get the Icon of the button. 6) public void setmnemonic(int a): is used to set the mnemonic on the button. 22
23 Example of displaying image on the button 7) public void addactionlistener(actionlistener a): is used to add the action listener to this object. Note: The JButton class extends AbstractButton class. import java.awt.event.*; import javax.swing.*; public class ImageButton{ ImageButton(){ JFrame f=new JFrame(); JButton b=new JButton(new ImageIcon("b.jpg")); b.setbounds(130,100,100, 40); f.add(b); f.setsize(300,400); f.setlayout(null); f.setvisible(true); f.setdefaultcloseoperation(jframe.exit_on_close); } public static void main(string[] args) { new ImageButton(); } } 23
24 JRadioButton class The JRadioButton class is used to create a radio button. Commonly used Constructors of JRadioButton class: JRadioButton(): creates an unselected radio button with no text. JRadioButton(String s): creates an unselected radio button with specified text. JRadioButton(String s, boolean selected): creates a radio button with the specified text and selected status. Commonly used Methods of AbstractButton class: 1) public void settext(string s): is used to set specified text on button. 2) public String gettext(): is used to return the text of the button. 3) public void setenabled(boolean b): is used to enable or disable the button. 4) public void seticon(icon b): is used to set the specified Icon on the button. 5) public Icon geticon(): is used to get the Icon of the button. 6) public void setmnemonic(int a): is used to set the mnemonic on the button. 24
25 Example of JRadioButton class 7) public void addactionlistener(actionlistener a): is used to add the action listener to this object. // Note: The JRadioButton class extends the JToggleButton class that extends AbstractButton class. import javax.swing.*; public class Radio { JFrame f; Radio(){ f=new JFrame(); JRadioButton r1=new JRadioButton("A) Male"); JRadioButton r2=new JRadioButton("B) FeMale"); r1.setbounds(50,100,70,30); r2.setbounds(50,150,70,30); ButtonGroup bg=new ButtonGroup(); bg.add(r1);bg.add(r2); f.add(r1);f.add(r2); f.setsize(300,300); f.setlayout(null); f.setvisible(true); } public static void main(string[] args) { new Radio(); } } 25
26 JTextArea class The JTextArea class is used to create a text area. It is a multiline area that displays the plain text only. Commonly used Constructors: JTextArea(): creates a text area that displays no text initally. JTextArea(String s): creates a text area that displays specified text initally. JTextArea(int row, int column): creates a text area with the specified number of rows and columns that displays no text initally.. JTextArea(String s, int row, int column): creates a text area with the specified number of rows and columns that displays specified text. Commonly used methods of JTextArea class: 1) public void setrows(int rows): is used to set specified number of rows. 2) public void setcolumns(int cols):: is used to set specified number of columns. 26
27 Example of JTextField class 3) public void setfont(font f): is used to set the specified font. 4) public void insert(string s, int position): is used to insert the specified text on the specified position. 5) public void append(string s): to append the given text to the end of the document. import java.awt.color; import javax.swing.*; public class TArea { JTextArea area; JFrame f; TArea(){ f=new JFrame(); area=new JTextArea(300,300); area.setbackground(color.black); area.setbounds(10,30,300,300); area.setforeground(color.white); f.add(area); f.setsize(400,400); f.setlayout(null); f.setvisible(true); } public static void main(string[] args) { new TArea(); } } 27
28 JComboBox class The JComboBox class is used to create the combobox (drop-down list). At a time only one item can be selected from the item list. Commonly used Constructors of JComboBox class: JComboBox() JComboBox(Object[] items) JComboBox(Vector<?> items) Commonly used methods of JComboBox class: 1) public void additem(object anobject): is used to add an item to the item list. 2) public void removeitem(object anobject): is used to delete an item to the item list. 3) public void removeallitems(): is used to remove all the items from the list. 4) public void seteditable(boolean b): is used to determine whether the JComboBox is editable. 28
29 Example of JComboBox class 5) public void addactionlistener(actionlistener a): is used to add the ActionListener. 6) public void additemlistener(itemlistener i): is used to add the ItemListener. import javax.swing.*; public class Combo { JFrame f; Combo(){ f=new JFrame("Combo ex"); String country[]={"india","aus","u.s.a","england","newzeland"}; JComboBox cb=new JComboBox(country); cb.setbounds(50, 50,90,20); f.add(cb); f.setvisible(true); } f.setlayout(null); f.setsize(400,500); public static void main(string[] args) { new Combo(); } } 29
30 JTable class The JTable class is used to display the data on two dimentional tables of cells. Commonly used Constructors of JTable class: JTable(): creates a table with empty cells. JTable(Object[][] rows, Object[] columns): creates a table with the specified data. Example of JTable class: import javax.swing.*; public class MyTable { JFrame f; MyTable(){ f=new JFrame(); String data[][]={ {"101","Amit","670000"}, {"102","Jai","780000"}, {"101","Sachin","700000"}}; String column[]={"id","name","salary"}; JTable jt=new JTable(data,column); 30
31 Example jt.setbounds(30,40,200,300); JScrollPane sp=new JScrollPane(jt); f.add(sp); f.setsize(300,400); // f.setlayout(null); f.setvisible(true); } public static void main(string[] args) { new MyTable(); } } 31
32 JColorChooser class The JColorChooser class is used to create a color chooser dialog box so that user can select any color. Commonly used Constructors of JColorChooser class: JColorChooser(): is used to create a color chooser pane with white color initially. JColorChooser(Color initialcolor): is used to create a color chooser pane with the specified color initially. Commonly used methods of JColorChooser class: public static Color showdialog(component c, String title, Color initialcolor): is used to show the color-chooser dialog box. 32
33 Example of JColorChooser class 33
34 import java.awt.event.*; import java.awt.*; import javax.swing.*; public class JColorChooserExample extends JFrame implements ActionListener{ JButton b; Container c; JColorChooserExample(){ c=getcontentpane(); c.setlayout(new FlowLayout()); b=new JButton("color"); b.addactionlistener(this); c.add(b); } public void actionperformed(actionevent e) { Color initialcolor=color.red; Color color=jcolorchooser.showdialog(this,"select a color",initialcolor); c.setbackground(color); } 34
35 Example of JColorChooser class public static void main(string[] args) { JColorChooserExample ch=new JColorChooserExample(); ch.setsize(400,400); ch.setvisible(true); ch.setdefaultcloseoperation(exit_on_close); } } 35
36 JProgressBar class The JProgressBar class is used to display the progress of the task. Commonly used Constructors of JProgressBar class: JProgressBar(): is used to create a horizontal progress bar but no string text. JProgressBar(int min, int max): is used to create a horizontal progress bar with the specified minimum and maximum value. JProgressBar(int orient): is used to create a progress bar with the specified orientation, it can be either Vertical or Horizontal by using SwingConstants.VERTICAL and SwingConstants.HORIZONTAL constants. JProgressBar(int orient, int min, int max): is used to create a progress bar with the specified orientation, minimum and maximum value. 36
37 Example of JProgressBar class Commonly used methods of JProgressBar class: 1) public void setstringpainted(boolean b): is used to determine whether string should be displayed. 2) public void setstring(string s): is used to set value to the progress string. 3) public void setorientation(int orientation): is used to set the orientation, it may be either vertical or horizontal by using SwingConstants.VERTICAL and SwingConstants.HORIZONTAL constants.. 4) public void setvalue(int value): is used to set the current value on the progress bar. import javax.swing.*; public class MyProgress extends JFrame{ JProgressBar jb; MyProgress(){ int i=0,num=0; jb=new JProgressBar(0,2000); jb.setbounds(40,40,200,30); 37
38 Example of JProgressBar class jb.setvalue(0); jb.setstringpainted(true); add(jb); setsize(400,400); setlayout(null); } public void iterate(){ while(i<=2000){ jb.setvalue(i); i=i+20; try{thread.sleep(150);}catch(exception e){} } } public static void main(string[] args) { MyProgress m=new MyProgress(); m.setvisible(true); m.iterate(); } } 38
39 JSlider class The JSlider is used to create the slider. By using JSlider a user can select a value from a specific range. Commonly used Constructors of JSlider class: JSlider(): creates a slider with the initial value of 50 and range of 0 to 100. JSlider(int orientation): creates a slider with the specified orientaion set by either JSlider.HORIZONTAL or JSlider.VERTICAL with the range 0 to 100 and intial value 50. JSlider(int min, int max): creates a horizontal slider using the given min and max. JSlider(int min, int max, int value): creates a horizontal slider using the given min, max and value. 39
40 JSlider class JSlider(int orientation, int min, int max, int value): creates a slider using the given orientation, min, max and value. Commonly used Methods of JSlider class: 1) public void setminortickspacing(int n): is used to set the minor tick spacing to the slider. 2) public void setmajortickspacing(int n): is used to set the major tick spacing to the slider. 3) public void setpaintticks(boolean b): is used to determine whether tick marks are painted. 4) public void setpaintlabels(boolean b): is used to determine whether labels are painted. 5) public void setpainttracks(boolean b): is used to determine whether track is painted. 40
41 Simple example of JSlider class import javax.swing.*; public class SliderExample1 extends JFrame{ public SliderExample1() { JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 50, 25); JPanel panel=new JPanel(); panel.add(slider); add(panel); } public static void main(string s[]) { SliderExample1 frame=new SliderExample1(); frame.pack(); frame.setvisible(true); } } 41
42 Example of JSlider class that paints ticks import javax.swing.*; public class SliderExample extends JFrame{ public SliderExample() { JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 50, 25); slider.setminortickspacing(2); slider.setmajortickspacing(10); slider.setpaintticks(true); slider.setpaintlabels(true); JPanel panel=new JPanel(); panel.add(slider); add(panel); } public static void main(string s[]) { SliderExample frame=new SliderExample(); frame.pack(); frame.setvisible(true); } } 42
43 BorderLayout (LayoutManagers) The LayoutManagers are used to arrange components in a particular manner. LayoutManager is an interface that is implemented by all the classes of layout managers. There are following classes that represents the layout managers: java.awt.borderlayout java.awt.flowlayout java.awt.gridlayout java.awt.cardlayout java.awt.gridbaglayout javax.swing.boxlayout javax.swing.grouplayout javax.swing.scrollpanelayout javax.swing.springlayout etc. 43
44 BorderLayout The BorderLayout is used to arrange the components in five regions: north, south, east, west and center. Each region (area) may contain one component only. It is the default layout of frame or window. The BorderLayout provides five constants for each region: 1. public static final int NORTH 2. public static final int SOUTH 3. public static final int EAST 4. public static final int WEST 5. public static final int CENTER Constructors of BorderLayout class: BorderLayout(): creates a border layout but with no gaps between the components. JBorderLayout(int hgap, int vgap): creates a border layout with the given horizontal and vertical gaps between the components. 44
45 Example of BorderLayout class 45
46 Example of BorderLayout class import java.awt.*; import javax.swing.*; public class Border { JFrame f; Border(){ f=new JFrame(); JButton b1=new JButton("NORTH");; JButton b3=new JButton("EAST");; JButton b2=new JButton("SOUTH");; JButton b4=new JButton("WEST");; JButton b5=new JButton("CENTER");; f.add(b1,borderlayout.north); f.add(b3,borderlayout.east); f.add(b5,borderlayout.center); f.add(b2,borderlayout.south); f.add(b4,borderlayout.west); f.setsize(300,300); f.setvisible(true); } public static void main(string[] args) { new Border(); } } 46
47 GridLayout The GridLayout is used to arrange the components in rectangular grid. One component is dispalyed in each rectangle. Constructors of GridLayout class: GridLayout(): creates a grid layout with one column per component in a row. GridLayout(int rows, int columns): creates a grid layout with the given rows and columns but no gaps between the components. GridLayout(int rows, int columns, int hgap, int vgap): creates a grid layout with the given rows and columns alongwith given horizontal and vertical gaps. 47
48 Example of GridLayout class 48
49 Example of GridLayout class import java.awt.*; import javax.swing.*; public class MyGridLayout{ JFrame f; MyGridLayout(){ f=new JFrame(); JButton b1=new JButton("1"); JButton b3=new JButton("3"); JButton b5=new JButton("5"); JButton b7=new JButton("7"); JButton b2=new JButton("2"); JButton b4=new JButton("4"); JButton b6=new JButton("6"); JButton b8=new JButton("8"); JButton b9=new JButton("9"); f.add(b1); f.add(b2); f.add(b3); f.add(b4); f.add(b5); f.add(b6); f.add(b7 f.add(b8); f.add(b9); f.setlayout(new GridLayout(3,3)); f.setsize(300,300); f.setvisible(true); } //set grid layout of 3 rows and 3 columns public static void main(string[] args) { new MyGridLayout(); } } 49
50 FlowLayout The FlowLayout is used to arrange the components in a line, one after another (in a flow). It is the default layout of applet or panel. Fields of FlowLayout class: 1. public static final int LEFT 2. public static final int RIGHT 3. public static final int CENTER 4. public static final int LEADING 5. public static final int TRAILING Constructors of FlowLayout class: FlowLayout(): creates a flow layout with centered alignment and a default 5 unit horizontal and vertical gap. FlowLayout(int align): creates a flow layout with the given alignment and a default 5 unit horizontal and vertical gap. FlowLayout(int align, int hgap, int vgap): creates a flow layout with the given alignment and the given horizontal and vertical gap. 50
51 Example of FlowLayout class 51
52 Example import java.awt.*; import javax.swing.*; public class MyFlowLayout{ JFrame f; MyFlowLayout(){ f=new JFrame(); JButton b1=new JButton("1"); JButton b2=new JButton("2"); JButton b3=new JButton("3"); JButton b4=new JButton("4"); JButton b5=new JButton("5"); f.add(b1);f.add(b2);f.add(b3);f.add(b4);f.add(b5); f.setlayout(new FlowLayout(FlowLayout.RIGHT)); //setting flow layout of right alignment f.setsize(300,300); f.setvisible(true); } public static void main(string[] args) { new MyFlowLayout(); } } 52
53 BoxLayout class The BoxLayout is used to arrange the components either vertically or horizontally. For this purpose, BoxLayout provides four constants. They are as follows: Note: BoxLayout class is found in javax.swing package. Fields of BoxLayout class: 1. public static final int X_AXIS 2. public static final int Y_AXIS 3. public static final int LINE_AXIS 4. public static final int PAGE_AXIS Constructor of BoxLayout class: 1. BoxLayout(Container c, int axis): creates a box layout that arranges the components with the given axis. 53
54 Example of BoxLayout class with Y-AXIS 54
55 Example of BoxLayout class with Y-AXIS import java.awt.*; import javax.swing.*; public class BoxLayoutExample1 extends Frame { Button buttons[]; public BoxLayoutExample1 () { buttons = new Button [5]; for (int i = 0;i<5;i++) { buttons[i] = new Button ("Button " + (i + 1)); add (buttons[i]); } setlayout (new BoxLayout (this, BoxLayout.Y_AXIS)); setsize(400,400); setvisible(true); } public static void main(string args[]){ BoxLayoutExample1 b=new BoxLayoutExample1(); } } 55
56 Example of BoxLayout class with X-AXIS 56
57 Example of BoxLayout class with X-AXIS import java.awt.*; import javax.swing.*; public class BoxLayoutExample2 extends Frame { Button buttons[]; public BoxLayoutExample2() { buttons = new Button [5]; for (int i = 0;i<5;i++) { buttons[i] = new Button ("Button " + (i + 1)); add (buttons[i]); } setlayout (new BoxLayout(this, BoxLayout.X_AXIS)); setsize(400,400); setvisible(true); } public static void main(string args[]){ BoxLayoutExample2 b=new BoxLayoutExample2(); } } 57
58 CardLayout class The CardLayout class manages the components in such a manner that only one component is visible at a time. It treats each component as a card that is why it is known as CardLayout. Constructors of CardLayout class: CardLayout(): creates a card layout with zero horizontal and vertical gap. CardLayout(int hgap, int vgap): creates a card layout with the given horizontal and vertical gap. Commonly used methods of CardLayout class: public void next(container parent): is used to flip to the next card of the given container. public void previous(container parent): is used to flip to the previous card of the given container. 58
59 CardLayout class public void first(container parent): is used to flip to the first card of the given container. public void last(container parent): is used to flip to the last card of the given container. public void show(container parent, String name): is used to flip to the specified card with the given name. 59
60 Example of CardLayout class import java.awt.*; import java.awt.event.*; import javax.swing.*; public class CardLayoutExample extends JFrame implements ActionListener{ CardLayout card; JButton b1,b2,b3; Container c; CardLayoutExample(){ c=getcontentpane(); card=new CardLayout(40,30); //create CardLayout object with 40 hor space and 30 ver space c.setlayout(card); b1=new JButton("Apple"); b3=new JButton("Cat"); b2=new JButton("Boy"); b1.addactionlistener(this); 60
61 Example of CardLayout class b2.addactionlistener(this); b3.addactionlistener(this); c.add("a",b1);c.add("b",b2);c.add("c",b3); } public void actionperformed(actionevent e) { card.next(c); } public static void main(string[] args) { CardLayoutExample cl=new CardLayoutExample(); cl.setsize(400,400); cl.setvisible(true); cl.setdefaultcloseoperation(exit_on_close); } } 61
62 Questions? 62
import javax.swing.*; public class Sample { JFrame f; Sample(){ f=new JFrame(); JButton b=new JButton("click"); b.setbounds(130,100,100, 40); f.add(b); f.setsize(400,500); f.setlayout(null); f.setvisible(true);
More informationCSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT
CSE 143 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/
More informationGraphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI
CBOP3203 Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI components like button, text input, scroll bar and others.
More informationSD Module-1 Advanced JAVA
Assignment No. 4 SD Module-1 Advanced JAVA R C (4) V T Total (10) Dated Sign Title: Transform the above system from command line system to GUI based application Problem Definition: Write a Java program
More informationGUI in Java TalentHome Solutions
GUI in Java TalentHome Solutions AWT Stands for Abstract Window Toolkit API to develop GUI in java Has some predefined components Platform Dependent Heavy weight To use AWT, import java.awt.* Calculator
More informationSD Module-1 Advanced JAVA. Assignment No. 4
SD Module-1 Advanced JAVA Assignment No. 4 Title :- Transform the above system from command line system to GUI based application Problem Definition: Write a Java program with the help of GUI based Application
More informationCSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT
CSE 331 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/
More informationIntroduction to the JAVA UI classes Advanced HCI IAT351
Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing
More informationCSE 331. Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT
CSE 331 Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT Lecturer: Michael Hotan slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer,
More informationPackages: Putting Classes Together
Packages: Putting Classes Together 1 Introduction 2 The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance) Extending interfaces The features in basic
More informationGraphical User Interfaces. Comp 152
Graphical User Interfaces Comp 152 Procedural programming Execute line of code at a time Allowing for selection and repetition Call one function and then another. Can trace program execution on paper from
More informationGraphic User Interfaces. - GUI concepts - Swing - AWT
Graphic User Interfaces - GUI concepts - Swing - AWT 1 What is GUI Graphic User Interfaces are used in programs to communicate more efficiently with computer users MacOS MS Windows X Windows etc 2 Considerations
More informationHandout 14 Graphical User Interface (GUI) with Swing, Event Handling
Handout 12 CS603 Object-Oriented Programming Fall 15 Page 1 of 12 Handout 14 Graphical User Interface (GUI) with Swing, Event Handling The Swing library (javax.swing.*) Contains classes that implement
More informationBasicsof. JavaGUI and SWING
Basicsof programming3 JavaGUI and SWING GUI basics Basics of programming 3 BME IIT, Goldschmidt Balázs 2 GUI basics Mostly window-based applications Typically based on widgets small parts (buttons, scrollbars,
More informationIntroduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008
Introduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008 Announcements A3 is up, due Friday, Oct 10 Prelim 1 scheduled for Oct 16 if you have a conflict, let us know now 2 Interactive
More informationGUI Design. Overview of Part 1 of the Course. Overview of Java GUI Programming
GUI Design Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh spring@imap.pitt.edu http://www.sis.pitt.edu /~spring Overview of Part 1 of the Course Demystifying
More informationWindow Interfaces Using Swing Objects
Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs
More informationCPS122 Lecture: Graphical User Interfaces and Event-Driven Programming
CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming Objectives: Last revised March 2, 2017 1. To introduce the notion of a component and some basic Swing components (JLabel, JTextField,
More informationGraphical User Interfaces
Graphical User Interfaces CSCI 136: Fundamentals CSCI 136: Fundamentals of Computer of Science Computer II Science Keith II Vertanen Keith Vertanen Copyright 2011 Overview Command line versus GUI apps
More informationTopic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more
Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"
More informationTopic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!
Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques
More informationJava. GUI building with the AWT
Java GUI building with the AWT AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses the controls defined by your OS therefore
More information11/6/15. Objec&ves. RouleQe. Assign 8: Understanding Code. Assign 8: Bug. Assignment 8 Ques&ons? PROGRAMMING PARADIGMS
Objec&ves RouleQe Assign 8: Refactoring for Extensibility Programming Paradigms Introduc&on to GUIs in Java Ø Event handling Nov 6, 2015 Sprenkle - CSCI209 1 Nov 6, 2015 Sprenkle - CSCI209 2 Assign 8:
More informationAll the Swing components start with J. The hierarchy diagram is shown below. JComponent is the base class.
Q1. If you add a component to the CENTER of a border layout, which directions will the component stretch? A1. The component will stretch both horizontally and vertically. It will occupy the whole space
More informationChapter 6: Graphical User Interfaces
Chapter 6: Graphical User Interfaces CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 6: Graphical User Interfaces CS 121 1 / 36 Chapter 6 Topics
More informationJava Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing
Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing Rui Moreira Some useful links: http://java.sun.com/docs/books/tutorial/uiswing/toc.html http://www.unix.org.ua/orelly/java-ent/jfc/
More informationBASICS OF GRAPHICAL APPS
CSC 2014 Java Bootcamp Lecture 7 GUI Design BASICS OF GRAPHICAL APPS 2 Graphical Applications So far we ve focused on command-line applications, which interact with the user using simple text prompts In
More informationCourse Status Networking GUI Wrap-up. CS Java. Introduction to Java. Andy Mroczkowski
CS 190 - Java Introduction to Java Andy Mroczkowski uamroczk@cs.drexel.edu Department of Computer Science Drexel University March 10, 2008 / Lecture 8 Outline Course Status Course Information & Schedule
More informationChapter 12 Advanced GUIs and Graphics
Chapter 12 Advanced GUIs and Graphics Chapter Objectives Learn about applets Explore the class Graphics Learn about the classfont Explore the classcolor Java Programming: From Problem Analysis to Program
More informationPROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7
PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,
More informationJava Swing. Lists Trees Tables Styled Text Components Progress Indicators Component Organizers
Course Name: Advanced Java Lecture 19 Topics to be covered Java Swing Lists Trees Tables Styled Text Components Progress Indicators Component Organizers AWT to Swing AWT: Abstract Windowing Toolkit import
More informationUNIT-V. There are two sets of Java APIs for graphics programming: AWT (Abstract Windowing Toolkit) and Swing.
UNIT-V Programming Graphical User Interface (GUI) 1. Introduction We can create high-level abstract data types called classes to mimic real-life things and represent entities in the problem space. These
More informationOutline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics
Topic 9: Swing Outline Swing = Java's GUI library Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 7: Expand moving shapes from Assignment 4 into game. "Programming
More informationDatenbank-Praktikum. Universität zu Lübeck Sommersemester 2006 Lecture: Swing. Ho Ngoc Duc 1
Datenbank-Praktikum Universität zu Lübeck Sommersemester 2006 Lecture: Swing Ho Ngoc Duc 1 Learning objectives GUI applications Font, Color, Image Running Applets as applications Swing Components q q Text
More informationStarting Out with Java: From Control Structures Through Objects Sixth Edition
Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes
More information2110: GUIS: Graphical User Interfaces
2110: GUIS: Graphical User Interfaces Their mouse had a mean time between failure of a week it would jam up irreparably, or... jam up on the table--... It had a flimsy cord whose wires would break. Steve
More informationUnit - 2 Abstract Window Toolkit
Abstract Window Toolkit: (AWT) Java AWT is an API to develop GUI or window-based application in java. Java AWT provides many of user interface objects are called Components of the Java AWT. Java AWT components
More informationWindow Interfaces Using Swing Objects
Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs
More informationThe Java Programming Language Basics. Identifiers, Keywords, and Types. Expressions and Flow Control. Object-Oriented Programming. Objects and Classes
Building GUIs 8 Course Map This module covers setup and layout of graphical user interfaces. It introduces the Abstract Windowing Toolkit, a package of classes from which GUIs are built. Getting Started
More informationPart I: Learn Common Graphics Components
OOP GUI Components and Event Handling Page 1 Objectives 1. Practice creating and using graphical components. 2. Practice adding Event Listeners to handle the events and do something. 3. Learn how to connect
More informationChapter 4. Swing 18 marks
Chapter 4 Swing 18 marks 1) Distinguish Between the Swing and AWT Ans: Swing It uses javax.swing package. It uses JApplet class Swing is light weight component It is Platform independent code Swing Support
More informationDr. Hikmat A. M. AbdelJaber
Dr. Hikmat A. M. AbdelJaber JWindow: is a window without a title bar or move controls. The program can move and resize it, but the user cannot. It has no border at all. It optionally has a parent JFrame.
More informationModule 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani The layout manager helps lay out the components held by this container. When you set a layout to null, you tell the
More informationCOMPSCI 230. Software Design and Construction. Swing
COMPSCI 230 Software Design and Construction Swing 1 2013-04-17 Recap: SWING DESIGN PRINCIPLES 1. GUI is built as containment hierarchy of widgets (i.e. the parent-child nesting relation between them)
More informationTable of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7...
Table of Contents Chapter 1 Getting Started with Java SE 7 1 Introduction of Java SE 7... 2 Exploring the Features of Java... 3 Exploring Features of Java SE 7... 4 Introducing Java Environment... 5 Explaining
More informationCHAPTER 2. Java Overview
Networks and Internet Programming (0907522) CHAPTER 2 Java Overview Instructor: Dr. Khalid A. Darabkh Objectives The objectives of this chapter are: To discuss the classes present in the java.awt package
More informationChina Jiliang University Java. Programming in Java. Java Swing Programming. Java Web Applications, Helmut Dispert
Java Programming in Java Java Swing Programming Java Swing Design Goals The overall goal for the Swing project was: To build a set of extensible GUI components to enable developers to more rapidly develop
More informationAdvanced Java Programming. Swing. Introduction to Swing. Swing libraries. Eran Werner, Tel-Aviv University Summer, 2005
Advanced Java Programming Swing Eran Werner, Tel-Aviv University Summer, 2005 19 May 2005 Advanced Java Programming, Summer 2005 1 Introduction to Swing The Swing package is part of the Java Foundation
More informationBuilding Java Programs Bonus Slides
Building Java Programs Bonus Slides Graphical User Interfaces Copyright (c) Pearson 2013. All rights reserved. Graphical input and output with JOptionPane JOptionPane An option pane is a simple dialog
More informationChapter 17 Creating User Interfaces
Chapter 17 Creating User Interfaces 1 Motivations A graphical user interface (GUI) makes a system user-friendly and easy to use. Creating a GUI requires creativity and knowledge of how GUI components work.
More informationJava Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1
Java Swing based on slides by: Walter Milner Java Swing Walter Milner 2005: Slide 1 What is Swing? A group of 14 packages to do with the UI 451 classes as at 1.4 (!) Part of JFC Java Foundation Classes
More informationThe AWT Event Model 9
The AWT Event Model 9 Course Map This module covers the event-based GUI user input mechanism. Getting Started The Java Programming Language Basics Identifiers, Keywords, and Types Expressions and Flow
More informationProgramming graphics
Programming graphics Need a window javax.swing.jframe Several essential steps to use (necessary plumbing ): Set the size width and height in pixels Set a title (optional), and a close operation Make it
More informationINTRODUCTION TO (GUIS)
INTRODUCTION TO GRAPHICAL USER INTERFACES (GUIS) Lecture 10 CS2110 Fall 2009 Announcements 2 A3 will be posted shortly, please start early Prelim 1: Thursday October 14, Uris Hall G01 We do NOT have any
More informationProgramming Mobile Devices J2SE GUI
Programming Mobile Devices J2SE GUI University of Innsbruck WS 2009/2010 thomas.strang@sti2.at Graphical User Interface (GUI) Why is there more than one Java GUI toolkit? AWT write once, test everywhere
More informationUser interfaces and Swing
User interfaces and Swing Overview, applets, drawing, action listening, layout managers. APIs: java.awt.*, javax.swing.*, classes names start with a J. Java Lectures 1 2 Applets public class Simple extends
More informationWhat is Widget Layout? Laying Out Components. Resizing a Window. Hierarchical Widget Layout. Interior Design for GUIs
What is Widget Layout? Laying Out Components Positioning widgets in their container (typically a JPanel or a JFrame s content pane) Basic idea: each widget has a size and position Main problem: what if
More informationCS 251 Intermediate Programming GUIs: Components and Layout
CS 251 Intermediate Programming GUIs: Components and Layout Brooke Chenoweth University of New Mexico Fall 2017 import javax. swing.*; Hello GUI public class HelloGUI extends JFrame { public HelloGUI ()
More informationJava AWT Windows, Text, & Graphics
2 AWT Java AWT Windows, Text, & Graphics The Abstract Windows Toolkit (AWT) contains numerous classes and methods that allow you to create and manage applet windows and standard windows that run in a GUI
More informationControl Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User
CSE3461 Control Flow Paradigms: Reacting to the User Control Flow: Overview Definition of control flow: The sequence of execution of instructions in a program. Control flow is determined at run time by
More informationContainers and Components
Containers and Components container A GUI has many components in containers. A container contains other components. A container is also a component; so a container may contain other containers. component
More informationGUI Programming: Swing and Event Handling
GUI Programming: Swing and Event Handling Sara Sprenkle 1 Announcements No class next Tuesday My Fourth of July present to you: No quiz! Assignment 3 due today Review Collections: List, Set, Map Inner
More informationGraphics programming. COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson)
Graphics programming COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson) Overview Aims To provide an overview of Swing and the AWT To show how to build
More informationLaying Out Components. What is Widget Layout?
Laying Out Components Interior Design for GUIs What is Widget Layout? Positioning widgets in their container (typically a JPanel or a JFrame s content pane) Basic idea: each widget has a size and position
More informationIS311 Programming Concepts. GUI Building with Swing
IS311 Programming Concepts GUI Building with Swing 1 Agenda Java GUI Support AWT Swing Creating GUI Applications Layout Managers 2 ต องม พ นความร ต อไปน ก อน Classes / Objects Method Overloading Inheritance
More informationAgenda. GUI Building with Swing ต องม พ นความร ต อไปน ก อน. Java Graphical User Interfaces. IS311 Programming Concepts
IS311 Programming Concepts GUI Building with Swing Agenda Java GUI Support AWT Swing Creating GUI Applications Layout Managers 1 2 ต องม พ นความร ต อไปน ก อน Classes / Objects Method Overloading Inheritance
More informationGraphical User Interfaces in Java - SWING
Graphical User Interfaces in Java - SWING Graphical User Interfaces (GUI) Each graphical component that the user can see on the screen corresponds to an object of a class Component: Window Button Menu...
More information14.2 Java s New Nimbus Look-and-Feel 551 Sample GUI: The SwingSet3 Demo Application As an example of a GUI, consider Fig. 14.1, which shows the SwingS
550 Chapter 14 GUI Components: Part 1 14.1 Introduction 14.2 Java s New Nimbus Look-and-Feel 14.3 Simple GUI-Based Input/Output with JOptionPane 14.4 Overview of Swing Components 14.5 Displaying Text and
More informationJava & Graphical User Interface II. Wang Yang wyang AT njnet.edu.cn
Java & Graphical User Interface II Wang Yang wyang AT njnet.edu.cn Outline Review of GUI (first part) What is Event Basic Elements of Event Programming Secret Weapon - Inner Class Full version of Event
More information1 GUI GUI GUI GUI GUI. GUI(Graphical User Interface) JDK java.awt. ? Component
99 6 1999.10.13 0 GUI GUI JDK 1.1 GUI 1 GUI GUI GUI(Graphical User Interface) GUI (GUI ) / ( GUI ) Java GUI JDK 1.1 1.2 1.2 Swing 1.1 java.awt GUI? Component setbounds(int, int, int, int) (x,y) setforeground(color)
More informationPart 3: Graphical User Interface (GUI) & Java Applets
1,QWURGXFWLRQWR-DYD3URJUDPPLQJ (( Part 3: Graphical User Interface (GUI) & Java Applets EE905-GUI 7RSLFV Creating a Window Panels Event Handling Swing GUI Components ƒ Layout Management ƒ Text Field ƒ
More informationMarcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science
Marcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science mluckner@mini.pw.edu.pl http://www.mini.pw.edu.pl/~lucknerm } Abstract Window Toolkit Delegates creation and
More informationFrames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling
Frames, GUI and events Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Introduction to Swing The Java AWT (Abstract Window Toolkit)
More informationSri Vidya College of Engineering & Technology
UNIT-V TWO MARKS QUESTION & ANSWER 1. What is the difference between the Font and FontMetrics class? Font class is used to set or retrieve the screen fonts.the Font class maps the characters of the language
More informationOBJECT ORIENTED PROGRAMMING. Java GUI part 1 Loredana STANCIU Room B616
OBJECT ORIENTED PROGRAMMING Java GUI part 1 Loredana STANCIU loredana.stanciu@upt.ro Room B616 What is a user interface That part of a program that interacts with the user of the program: simple command-line
More informationGraphics. Lecture 18 COP 3252 Summer June 6, 2017
Graphics Lecture 18 COP 3252 Summer 2017 June 6, 2017 Graphics classes In the original version of Java, graphics components were in the AWT library (Abstract Windows Toolkit) Was okay for developing simple
More informationBuilding a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver
Building a GUI in Java with Swing CITS1001 extension notes Rachel Cardell-Oliver Lecture Outline 1. Swing components 2. Building a GUI 3. Animating the GUI 2 Swing A collection of classes of GUI components
More informationSwing. By Iqtidar Ali
Swing By Iqtidar Ali Background of Swing We have been looking at AWT (Abstract Window ToolKit) components up till now. Programmers were not comfortable when doing programming with AWT. Bcoz AWT is limited
More informationJava Graphical User Interfaces
Java Graphical User Interfaces 1 The Abstract Windowing Toolkit (AWT) Since Java was first released, its user interface facilities have been a significant weakness The Abstract Windowing Toolkit (AWT)
More informationencompass a group of features for building Graphical User Interfaces (GUI).
Java GUI (intro) JFC Java Foundation Classes encompass a group of features for building Graphical User Interfaces (GUI). javax.swing.* used for building GUIs. Some basic functionality is already there
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 10(b): Working with Controls Agenda 2 Case study: TextFields and Labels Combo Boxes buttons List manipulation Radio buttons and checkboxes
More informationCONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13
CONTENTS Chapter 1 Getting Started with Java SE 6 1 Introduction of Java SE 6... 3 Desktop Improvements... 3 Core Improvements... 4 Getting and Installing Java... 5 A Simple Java Program... 10 Compiling
More informationMODEL UPDATES MANIPULATES USER
1) What do you mean by MVC architecture? Explain its role in modern applications and list its advantages(may-2013,jan-2013,nov-2011). In addition to dividing the application into three kinds of components,
More informationuser-friendly and easy to use.
Java Graphic User Interface GUI Basic Dr. Umaporn Supasitthimethee Computer Programming II -2- Java GUI A graphical user interface (GUI) makes a system user-friendly and easy to use. Creating a GUI requires
More informationChapter 7: A First Look at GUI Applications
Chapter 7: A First Look at GUI Applications Starting Out with Java: From Control Structures through Objects Fourth Edition by Tony Gaddis Addison Wesley is an imprint of 2010 Pearson Addison-Wesley. All
More informationCSC 1214: Object-Oriented Programming
CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:
More informationThe Abstract Windowing Toolkit. Java Foundation Classes. Swing. In April 1997, JavaSoft announced the Java Foundation Classes (JFC).
The Abstract Windowing Toolkit Since Java was first released, its user interface facilities have been a significant weakness The Abstract Windowing Toolkit (AWT) was part of the JDK form the beginning,
More informationModule 4 Multi threaded Programming, Event Handling. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Module 4 Multi threaded Programming, Event Handling OOC 4 th Sem, B Div 2017-18 Prof. Mouna M. Naravani Event Handling Complete Reference 7 th ed. Chapter No. 22 Event Handling Any program that uses a
More informationThe most striking feature of Java is Platform neutralness. Java is the first language that is not tied to any particular hardware or O.S.
HISTORY Java is the general purpose, true object oriented programming language and is highly suitable for modeling the real world and solving the real world problems. In the company Sun Microsystem, James
More informationJRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();
Q)Write a program to design an interface containing fields User ID, Password and Account type, and buttons login, cancel, edit by mixing border layout and flow layout. Add events handling to the button
More informationCommand-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.
1 CS257 Computer Science I Kevin Sahr, PhD Lecture 14: Graphical User Interfaces Command-Line Applications 2 The programs we've explored thus far have been text-based applications A Java application is
More informationSwing UI. Powered by Pentalog. by Vlad Costel Ungureanu for Learn Stuff
Swing UI by Vlad Costel Ungureanu for Learn Stuff User Interface Command Line Graphical User Interface (GUI) Tactile User Interface (TUI) Multimedia (voice) Intelligent (gesture recognition) 2 Making the
More informationH212 Introduction to Software Systems Honors
Introduction to Software Systems Honors Lecture #19: November 4, 2015 1/14 Third Exam The third, Checkpoint Exam, will be on: Wednesday, November 11, 2:30 to 3:45 pm You will have 3 questions, out of 9,
More informationBM214E Object Oriented Programming Lecture 13
BM214E Object Oriented Programming Lecture 13 Events To understand how events work in Java, we have to look closely at how we use GUIs. When you interact with a GUI, there are many events taking place
More informationCPS122 Lecture: Graphical User Interfaces and Event-Driven Programming
CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming Objectives: Last revised 1/15/10 1. To introduce the notion of a component and some basic Swing components (JLabel, JTextField, JTextArea,
More informationGraphical User Interface (GUI)
Graphical User Interface (GUI) Layout Managment 1 Hello World Often have a static method: createandshowgui() Invoked by main calling invokelater private static void createandshowgui() { } JFrame frame
More informationGraphical User Interface
Lecture 10 Graphical User Interface An introduction Sahand Sadjadee sahand.sadjadee@liu.se Programming Fundamentals 725G61 http://www.ida.liu.se/~725g61/ Department of Computer and Information Science
More informationCS11 Java. Fall Lecture 4
CS11 Java Fall 2006-2007 Lecture 4 Today s Topics Interfaces The Swing API Event Handlers Inner Classes Arrays Java Interfaces Classes can only have one parent class No multiple inheritance in Java! By
More informationIII/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION. Electronics & Instrumentation Engineering Object Oriented Programming with JAVA
Hall Ticket Number: 14EI605 April, 2018 Sixth Semester Time: Three Hours Answer Question No.1 compulsorily. Answer ONE question from each unit. III/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION
More informationSystems Programming Graphical User Interfaces
Systems Programming Graphical User Interfaces Julio Villena Román (LECTURER) CONTENTS ARE MOSTLY BASED ON THE WORK BY: José Jesús García Rueda Systems Programming GUIs based on Java
More information