JText Area Constructors F JText Areaint rows int
- Slides: 20
JText. Area Constructors F JText. Area(int rows, int columns) Creates a text area with the specified number of rows and columns. F JText. Area(String s, int rows, int columns) Creates a text area with the initial text and the number of rows and columns specified. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 1
JText. Area Properties F text F editable F columns F line. Wrap F wrap. Style. Word F rows F line. Count F tab. Size Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 2
Check. Box F ����������� on-off ��������� off F ���� check box ������� JCheck. Box ch = new JCheck. Box(); F �� constructor ������ JCheck. Box(String text) JCheck. Box(String text, boolean b) F �� method true/false ������� check. Box ���� Obj. set. Selected(boolean b) Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All Obj. is. Selected() //return true/false on Obj. Check. Bok rights reserved. 0 -13 -222158 -6 3
JCheck. Box inherits all the properties such as text, icon, mnemonic, vertical. Alignment, horizontal. Text. Position, vertical. Text. Position, and selected from Abstract. Button, and provides several constructors to create check boxes. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 4
Radio. Button F ��������������������� F ������� JRadio. Button ����� F ������� Button. Group ������� F Radio. Button Constructor JRadio. Button() JRadio. Button(Icon icon) JRadio. Button(String text) Button. Group() Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 5 F ����������� Create. Radio 1. java
Event Hangling Component Event Interface Class ���� Override JRadio. Button Item. Listener item. State. Changed(Item. Event e) JCheck. Box Item. Listener item. State. Changed(Item. Event e) -get. Item. Selectable() iตรวจสอบ Checkbox นนๆถกคลกหรอไม Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 6
JRadio. Button Radio buttons are variations of check boxes. They are often used in the group, where only one button is checked at a time. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 7
Grouping Radio Buttons Button. Group btg = new Button. Group(); btg. add(jrb 1); btg. add(jrb 2); Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 8
List ���������������������� F JList list = new JList(); F �� constructor JList() JList(Object item[]) F �� method set. Fixed. Cell. Width(int i) set. Visble. Row. Count(int i) //Set ������� List // set ����������� get. Selected. Index() //return ����������� List set. Selected. Index(int i) Liang, Introduction to Java Programming, Sixth Edition, (c)//Set 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 9
Event Hangling Component ���� Interface Class Event List. Selection. Listener JList Override value. Changed(List. Selection. Event e) -get. Source() iใชในการคนคาวาปมใดถกกด -get. Text() iสำหรบดงขอความจาก -set. Text() iสำหรบกำหนดขอความ -get. Selected. Index() iจะคนคาตำแหนงรายการใน -get. Selected. Value() iจะคนขอความทอยใน Text นนๆ list ทถกเลอก list Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 10
JList A list is a component that performs basically the same function as a combo box, but it enables the user to choose a single value or multiple values. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 11
JList Constructors F JList() Creates an empty list. F JList(Object[] string. Items) Creates a new list initialized with items. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 12
JList Properties F selected. Indexd F selected. Indices F selected. Values F selection. Mode F visible. Row. Count Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 13
Combo Box F ���������� List ���� 1 �������� F JCombo. Box com = new JCombo. Box(); Constructor JCombo. Box() JCombo. Box(Object item[]) F ������� set. Maximum. Row. Count)int i) //���������� combo Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 14
Event Hangling Component ���� Interface Class Event Action. Listener JCombo. Box Override action. Performed(Action. Event e) get. Source() iใชในการคนคาวาปมใดถกกด get. Text() iสำหรบดงขอความจาก set. Text() iสำหรบกำหนดขอความ get. Selected. Index() ทถกเลอก iจะคนคาตำแหนงรายการใน get. Selected. Item() iจะคนขอความทอยใน Text นนๆ Combo. Box Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 15
JCombo. Box A combo box is a simple list of items from which the user can choose. It performs basically the same function as a list, but can get only one value. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 16
JCombo. Box Methods To add an item to a JCombo. Box jcbo, use jcbo. add. Item(Object item) To get an item from JCombo. Box jcbo, use jcbo. get. Item() Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 17
Menu F ��������������������� F �������� § ����� Menu bars ��� Class “JMenu. Bar” § ����� Menu ��� Class “JMenu” § ����� Menu Item ������ Menu ��� Class “JMenu. Item” ���� Subclass ��� Class JMenu. Item § ����� Menu ������ Menu bars § ����� Menu bar ������ Frame ��� “set. JMenu. Bar()” Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 18
Menu F F Constructor JMenu. Bar() JMenu(String text) JMenu. Item(String text) Method add. Separator() Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 19
Event Hangling Component ���� Interface Class Event Action. Listener JMenu. Item -get. Source() Override action. Performed(Action. Event e) iใชในการคนคาวาปมใดถกเลอก Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0 -13 -222158 -6 20
- Int sum(int a int n) int sum=0 i
- Divideint
- Int max(int x int y)
- Interface calculator public int add class test
- Public void drawsquare(int x, int y, int len)
- Overloading methods and constructors in java
- Considerate constructors scoring matrix
- Constructors
- Considerate constructors best practice hub
- Constructors and destructors in c
- Int main int argc char argv
- Voidswap
- #include stdio.h void main()
- Void
- Int factorial(int n)
- Max int
- Interface myinterface int foo(int x)
- Int main() int num=4
- Arduino constant int
- Include
- Jtext pane