11장.key

Similar documents
PowerPoint 프레젠테이션

9장.key

10장.key

강의자료

<4D F736F F F696E74202D20C1A63230C0E520BDBAC0AE20C4C4C6F7B3CDC6AE203128B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

public class FlowLayoutPractice extends JFrame { public FlowLayoutPractice() { super("flowlayout Practice"); this. Container contentpane = getcontentp

모든스윙컴포넌트에는텍스트옆에이미지를추가로표시할수있다. ImageIcon image = new ImageIcon("image.gif"); JLabel label = new JLabel(" 이미지레이블 "); label.seticon(image);

gnu-lee-oop-kor-lec10-1-chap10

<4D F736F F F696E74202D20C1A63233C0E520B1D7B7A1C7C820C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63139C0E520B9E8C4A120B0FCB8AEC0DA28B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

PowerPoint Presentation

Microsoft PowerPoint - 14주차 강의자료

Microsoft PowerPoint - java1-lecture11.ppt [호환 모드]

Microsoft PowerPoint - 04-UDP Programming.ppt

Microsoft PowerPoint - EEL2 Lecture10 -Swing and Event Handling.pptx

자바GUI실전프로그래밍2_장대원.PDF

PowerPoint 프레젠테이션

PowerPoint Presentation

Java Programing Environment

No Slide Title

제8장 자바 GUI 프로그래밍 II

JMF3_심빈구.PDF

Microsoft PowerPoint - [JAVA프로그래밍]9장GUI

슬라이드 1

(Microsoft PowerPoint - java2-lecture6.ppt [\310\243\310\257 \270\360\265\345])

PowerPoint 프레젠테이션

<4D F736F F F696E74202D20C1A63138C0E520C0CCBAA5C6AE20C3B3B8AE28B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

Microsoft PowerPoint - java2-lecture5.ppt [호환 모드]

Microsoft PowerPoint - java2-lecture6.ppt [호환 모드]

Microsoft PowerPoint - java1-lecture10.ppt [호환 모드]

11-GUI.key

02 C h a p t e r Java

Chap12

PowerPoint 프레젠테이션

Microsoft Word - java18-1-final-answer.doc

iii. Design Tab 을 Click 하여 WindowBuilder 가자동으로생성한 GUI 프로그래밍환경을확인한다.

PowerPoint 프레젠테이션

10 이벤트 처리와 그래픽 프로그래밍.key

슬라이드 1

중간고사

PowerPoint Presentation

DB 에데이터저장을위한입력창설계 - JLabel, JTextField, JButton 을이용한입력창설계 - 2 -

No Slide Title

PowerPoint Presentation

Microsoft PowerPoint - Java-03.pptx

Microsoft PowerPoint - ÀÚ¹Ù08Àå-1.ppt

제8장 자바 GUI 프로그래밍 II

PowerPoint 프레젠테이션

PowerPoint Presentation

rmi_박준용_final.PDF

Microsoft PowerPoint - java1-lecture11.ppt [호환 모드]

05-class.key

PowerPoint 프레젠테이션

연습문제이론홀수정답

PowerPoint 프레젠테이션

비긴쿡-자바 00앞부속

Microsoft Word - java19-1-final-answer.doc

09-interface.key

<4D F736F F F696E74202D20C1A63236C0E520BED6C7C3B8B428B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

JTable과 MVC(Model-View-Controller) 구조 - 모델-뷰-컨트롤러구조는데이터의저장과접근에대한제공은모델이담당하고, 화면표시는뷰, 이벤트의처리는컨트롤러가하도록각역할을구분한구조이다. 즉, 역할의분담을통하여상호간의영향을최소화하고각요소의독립성을보장하여독자

10-Java Applet

<4D F736F F F696E74202D205B4A415641C7C1B7CEB1D7B7A1B9D65D3130C0E5C0CCBAA5C6AEC3B3B8AE>

ch09

PowerPoint 프레젠테이션

Microsoft PowerPoint - 06-Chapter09-Event.ppt

PowerPoint 프레젠테이션

Microsoft PowerPoint - Java7.pptx

Cluster management software

슬라이드 1

제13강. 스윙(Swing)

PowerPoint Presentation

12-file.key

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

PowerPoint 프레젠테이션

歯제9장.PDF

(Microsoft PowerPoint - java1-lecture7.ppt [\310\243\310\257 \270\360\265\345])

쉽게 풀어쓴 C 프로그래밍

Microsoft PowerPoint - ÀÚ¹Ù08Àå-2.ppt

(Microsoft PowerPoint - LZVNQBAJWGTC.ppt [\310\243\310\257 \270\360\265\345])

Microsoft PowerPoint - 12장

12장.그래픽 사용자 인터페이스

Java Coding Standard

PowerPoint Presentation

untitled

07 자바의 다양한 클래스.key

13ÀåÃß°¡ºÐ

자바 쓰레드 능숙하게 다루기

5장.key

PowerPoint 프레젠테이션

Cluster management software

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형

Microsoft PowerPoint - RMI.ppt

그래픽 chapter.1 스윙컴포넌트그리기 컴포넌트는자신의모양을스스로그린다 X-window, MFC, C# GUI, Android 등 GUI 플랫폼에서 GUI 컴포넌트는스스로자신의모양을그린다. 자바의스윙도예외는아니다. JButton은버튼모양을그리는코드를내장하고, JCo

* Factory class for query and DML clause creation * tiwe * */ public class JPAQueryFactory implements JPQLQueryFactory private f

자바 프로그래밍

JMF2_심빈구.PDF

Java

Microsoft PowerPoint - 10장

Design Issues

01-OOPConcepts(2).PDF

Transcription:

JAVA Programming 1

GUI 2 2 1. GUI! GUI! GUI.! GUI! GUI 2. GUI!,,,!! GUI! GUI 11 : GUI 12 : GUI

3

4, JComponent

11-1 :, JComponent 5 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JComponentEx extends JFrame { public JComponentEx() { super("jcomponent "); Container c = getcontentpane(); c.setlayout(new FlowLayout()); JButton b1 = new JButton("Magenta/Yellow Button"); JButton b2 = new JButton(" Disabled Button "); JButton b3 = new JButton("getX(), gety()"); b1.setbackground(color.yellow); // b1.setforeground(color.magenta); // b1.setfont(new Font("Arial", Font.ITALIC, 20)); // Arial, 20 b2.setenabled(false); // b3.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { JButton b = (JButton)e.getSource(); JComponentEx frame = (JComponentEx)b.getTopLevelAncestor(); frame.settitle(b.getx() + "," + b.gety()); // ); c.add(b1); c.add(b2); c.add(b3); // setsize(260,200); setvisible(true); public static void main(string[] args) { new JComponentEx();

JLabel, 6 JLabel!

7 JLabel textlabel = new JLabel("");! ImageIcon! : png, gif, jpg sunset.jpg "images/sunset.jpg" ImageIcon image = new ImageIcon("images/sunset.jpg"); JLabel imagelabel = new JLabel(image); ImageIcon image = new ImageIcon("images/sunset.jpg"); JLabel label = new JLabel("", image, SwingConstants.CENTER);

11-2 : JLabel 8 import javax.swing.*; import java.awt.*; public class LabelEx extends JFrame { public LabelEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); JLabel textlabel = new JLabel("."); ImageIcon beauty = new ImageIcon("images/beauty.jpg"); JLabel imagelabel = new JLabel(beauty); ImageIcon normalicon = new ImageIcon("images/normalIcon.gif"); JLabel label = new JLabel(" ", normalicon, SwingConstants.CENTER); c.add(textlabel); c.add(imagelabel); c.add(label); setsize(400,600); setvisible(true); public static void main(string [] args) { new LabelEx();

JButton, 9!! Action! "hello" JButton btn = new JButton("hello");

10 3! 3! 3 1. : JButton seticon(icon image) 2. : JButton.setRolloverIcon(Icon); 3. : JButton.setPressedIcon(Icon)! new ImageIcon( ); ) new ImageIcon("images/normalIcon.gif);

11-3 : JButton 11 import javax.swing.*; import java.awt.*; public class ButtonEx extends JFrame { public ButtonEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); ImageIcon normalicon = new ImageIcon("images/normalIcon.gif"); ImageIcon rollovericon = new ImageIcon("images/rolloverIcon.gif"); ImageIcon pressedicon = new ImageIcon("images/pressedIcon.gif"); JButton btn = new JButton("call~~", normalicon); btn.setpressedicon(pressedicon); btn.setrollovericon(rollovericon); (normalicon.gif) (rollovericon.gif) c.add(btn); setsize(250,150); setvisible(true); public static void main(string [] args) { new ButtonEx(); (pressedicon.gif)

(Alignment) 12 : :

JCheckBox, 13 JCheckBox! (selected) (deselected)

14! "" JCheckBox c = new JCheckBox("");! "" JCheckBox c = new JCheckBox("", true);!!! cherry.jpg "" ImageIcon cherryicon = new ImageIcon("images/cherry.jpg"); ImageIcon selectedcherryicon = new ImageIcon("images/ selectedcherry.jpg"); JCheckBox cherry = new JCheckBox("", cherryicon); cherry.setselectedicon(selectedcherryicon); //

11-4 : 15 import javax.swing.*; import java.awt.*; public class CheckBoxEx extends JFrame { public CheckBoxEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); ImageIcon cherryicon = new ImageIcon("images/cherry.jpg"); ImageIcon selectedcherryicon = new ImageIcon( "images/selectedcherry.jpg"); JCheckBox apple = new JCheckBox(""); JCheckBox pear = new JCheckBox("", true); JCheckBox cherry = new JCheckBox("", cherryicon); cherry.setborderpainted(true); cherry.setselectedicon(selectedcherryicon); cherry.jpg( ) c.add(apple); c.add(pear); c.add(cherry); setsize(250,150); setvisible(true); public static void main(string [] args) { new CheckBoxEx(); selectedcherry.jpg( )

JCheckBox Item 16 Item! JCheckBox c = new JCheckBox(""); c.setselected(true); // ItemListener ItemEvent

11-5 : ItemEvent import javax.swing.*; import java.awt.event.*; import java.awt.*; public class CheckBoxItemEventEx extends JFrame { private JCheckBox [] fruits = new JCheckBox [3]; private String [] names = {"", "", ""; private JLabel sumlabel; public CheckBoxItemEventEx() { settitle(" ItemEvent "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); c.add(new JLabel(" 100, 500, 20000")); MyItemListener listener = new MyItemListener(); for(int i=0; i<fruits.length; i++) { fruits[i] = new JCheckBox(names[i]); fruits[i].setborderpainted(true); c.add(fruits[i]); fruits[i].additemlistener(listener); sumlabel = new JLabel(" 0."); c.add(sumlabel); setsize(250,200); setvisible(true); class MyItemListener implements ItemListener { private int sum = 0; // public void itemstatechanged(itemevent e) { if(e.getstatechange() == ItemEvent.SELECTED) { if(e.getitem() == fruits[0]) sum += 100; else if(e.getitem() == fruits[1]) sum += 500; else sum += 20000; else { if(e.getitem() == fruits[0]) sum -= 100; else if(e.getitem() == fruits[1]) sum -= 500; else sum -= 20000; sumlabel.settext(" "+ sum + "."); public static void main(string [] args) { new CheckBoxItemEventEx(); 17

JRadioButton, 18 JRadioButton!?,! /!

19 1. 2. 3. 4. ButtonGroup group = new ButtonGroup(); JRadioButton apple= new JRadioButton(""); JRadioButton pear= new JRadioButton(""); JRadioButton cherry= new JRadioButton(""); group.add(apple); group.add(pear); group.add(cherry); container.add(apple); container.add(pear); container.add(cherry);

11-6 : ( ) g import javax.swing.*; import java.awt.*; public class RadioButtonEx extends JFrame { public RadioButtonEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); ImageIcon cherryicon = new ImageIcon("images/cherry.j pg" ); ImageIcon selectedcherryicon = new ImageIcon("images/selectedCherry.jpg"); ButtonGroup g = new ButtonGroup(); JRadioButton apple = new JRadioButton(""); JRadioButton pear = new JRadioButton("", true); JRadioButton cherry = new JRadioButton("", cherryicon); cherry.setborderpainted(true); cherry.setselectedicon(selectedcherryicon); g.add(apple); g.add(pear); g.add(cherry); 20 c.add(apple); c.add(pear); c.add(cherry); setsize(250,150); setvisible(true); public static void main(string [] args) { new RadioButtonEx();

11-7 : JRadioButton Item import javax.swing.*; import java.awt.event.*; import java.awt.*; public class RadioButtonItemEventEx extends JFrame { private JRadioButton [] radio = new JRadioButton [3]; private String [] text = {"", "", ""; private ImageIcon [] image = { new ImageIcon("images/apple.jpg"), new ImageIcon("images/pear.jpg"), new ImageIcon("images/cherry.jpg"); private JLabel imagelabel = new JLabel(); public RadioButtonItemEventEx() { settitle(" Item Event "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new BorderLayout()); JPanel radiopanel = new JPanel(); radiopanel.setbackground(color.gray); ButtonGroup g = new ButtonGroup(); class MyItemListener implements ItemListener { public void itemstatechanged(itemevent e) { if(e.getstatechange() == ItemEvent.DESELECTED) return; if(radio[0].isselected()) imagelabel.seticon(image[0]); else if(radio[1].isselected()) imagelabel.seticon(image[1]); else imagelabel.seticon(image[2]); public static void main(string [] args) { new RadioButtonItemEventEx(); 21 for(int i=0; i<radio.length; i++) { radio[i] = new JRadioButton(text[i]); g.add(radio[i]); radiopanel.add(radio[i]); radio[i].additemlistener(new MyItemListener()); radio[2].setselected(true); c.add(radiopanel, BorderLayout.NORTH); c.add(imagelabel, BorderLayout.CENTER); imagelabel.sethorizontalalignment(swingconstants.center); setsize(250,200); setvisible(true); setselected(true) Item

11-7 22 "" ""

JTextField, 23 JTextField!? () <Enter> Action

11-8 : 24 import javax.swing.*; import java.awt.*; public class TextFieldEx extends JFrame { public TextFieldEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); c.add(new JLabel(" ")); c.add(new JTextField(20)); c.add(new JLabel(" ")); c.add(new JTextField(" ", 20)); c.add(new JLabel(" ")); c.add(new JTextField("...", 20)); setsize(300,150); setvisible(true); public static void main(string [] args) { new TextFieldEx();

JTextField 25! JTextField.setEditable(false);! JTextField.setText("hello");! JTextField.setFont(new Font("", Font.ITALIC, 20);

TextArea, 26 JTextArea!? JScrollPane

27 7 20 new JTextArea( hello, 7, 20); new JScrollPane(new JTextArea( hello, 7, 20));

11-9 : JTextArea import javax.swing.*; import java.awt.event.*; import java.awt.*; public class TextAreaEx extends JFrame { private JTextField tf = new JTextField(20); private JTextArea ta = new JTextArea(7, 20); public TextAreaEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); c.add(new JLabel(" <Enter> ")); c.add(tf); c.add(new JScrollPane(ta)); 28 <Enter> Action <Enter> tf.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { JTextField t = (JTextField)e.getSource(); ta.append(t.gettext() + "\n"); t.settext(""); ); setsize(300,300); setvisible(true); public static void main(string [] args) { new TextAreaEx(); <Enter> tf ta

JList<E>, 29 JList<E>!? JComboBox<E> JList<String> JScrollPane Jlist<E>! JList<E> JDK7 <E>

1. String [] fruits= {"apple", "banana", "kiwi", "mango", "pear", "peach", "berry", "strawberry", "blackberry"; JList<String> strlist = new JList<String>(fruits); 2. Vector Vector v = new Vector(); v.add("apple"); v.add("banana"); v.add("kiwi"); JList<String> vlist = new JList<String>(v); 3. JList setlistdata() ImageIcon [] images = {new ImageIcon("images/icon1.png"), new ImageIcon("images/icon2.png"), new ImageIcon("images/icon3.png"), new ImageIcon("images/icon4.png") ; JList<ImageIcon> imagelist = new JList<ImageIcon>(); imagelist.setlistdata(images); 4. 30 JList<String> scrolllist = new JList<String>(fruits); new JScrollPane(scrollList);

11-10 : import javax.swing.*; import java.awt.*; public class ListEx extends JFrame { private String [] fruits= {"apple", "banana", "kiwi", "mango", "pear", "peach", "berry", "strawberry", "blackberry"; private ImageIcon [] images = { new ImageIcon("images/icon1.png"), new ImageIcon("images/icon2.png"), new ImageIcon("images/icon3.png"), new ImageIcon("images/icon4.png") ; public ListEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); JList<String> strlist = new JList<String>(fruits); c.add(strlist); JList<ImageIcon> imagelist = new JList<ImageIcon>(); imagelist.setlistdata(images); c.add(imagelist); JList<String> scrolllist = new JList<String>(fruits); c.add(new JScrollPane(scrollList)); 31 setsize(300,300); setvisible(true); public static void main(string [] args) { new ListEx();

32 JList<E>! JList<E>(Vector listdata) JList<E>(Object [] listdata)! JList<E> setlistdata() Vector<String> v = new Vector<String>(); v.add(""); v.add(""); JList<String> namelist = new JList<String>(v); // v, v v.add(""); namelist.setlistdata(v);

11-11 : 33 import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class ListChangeEx extends JFrame { private JTextField tf = new JTextField(10); private Vector<String> v = new Vector<String>(); private JList<String> namelist = new JList<String>(v); public ListChangeEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); c.add(new JLabel(" <Enter> ")); c.add(tf); v.add(""); v.add(""); namelist.setvisiblerowcount(5); namelist.setfixedcellwidth(100); c.add(new JScrollPane(nameList)); setsize(300,300); setvisible(true); // JTextField ActionLister. <Enter> tf.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { JTextField t = (JTextField)e.getSource(); v.add(t.gettext()); t.settext(""); namelist.setlistdata(v); ); public static void main(string [] args) { new ListChangeEx(); <Enter>,

JComboBox<E>, 34 JComboBox<E>!?, JComboBox<String>

11-12 : 35 import javax.swing.*; import java.awt.*; public class ComboBoxEx extends JFrame { private String [] fruits = {"apple", "banana", "kiwi", "mango", "pear", "peach", "berry", "strawberry", "blackberry"; private String [] names = {"kitae", "jaemoon", "hyosoo", "namyun"; public ComboBoxEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); JComboBox<String> strcombo = new JComboBox<String>(fruits); c.add(strcombo); additem() JComboBox<String> namecombo = new JComboBox<String>(); for(int i=0; i<names.length; i++) namecombo.additem(names[i]); c.add(namecombo); setsize(300,300); setvisible(true); public static void main(string [] args) { new ComboBoxEx(); additem()

JComboBox<E> Action 36 Action! JComboBox<E>

11-13 : Action import javax.swing.*; import java.awt.event.*; import java.awt.*; public class ComboActionEx extends JFrame { private String [] fruits = {"apple", "banana", "kiwi", "mango"; private ImageIcon [] images = { new ImageIcon("images/apple.jpg"), new ImageIcon("images/banana.jpg"), new ImageIcon("images/kiwi.jpg"), new ImageIcon("images/mango.jpg"); private JLabel imglabel = new JLabel(images[0]); private JComboBox<String> strcombo = new JComboBox<String>(fruits); 37 public ComboActionEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); c.add(strcombo); c.add(imglabel); strcombo.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { JComboBox<String> cb = (JComboBox<String>)e.getSource(); int index = cb.getselectedindex(); imglabel.seticon(images[index]); ); setsize(300,250); setvisible(true); public static void main(string [] args) { new ComboActionEx();

JSlider, 38 JSlider!?

39 track /! void setorientation(int orientation)! void setpainttrack(boolean b) orientation : JSlider.HORIZONTAL, JSlider.VERTICAL! void setmaximum(int max)! void setminimum(int min) label /! void setpaintlabels(boolean b) b true track! void setmajortickspacing(int space)! void setminortickspacing(int space) b true label tick /! void setvaule(int n)! void setpaintticks(boolean b) b true n.

11-14 : JSlider 40 import javax.swing.*; import java.awt.*; 0~200 public class SliderEx extends JFrame { public SliderEx() { settitle(" "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 200, 100); slider.setpaintlabels(true); slider.setpaintticks(true); slider.setpainttrack(true); slider.setmajortickspacing(50); slider.setminortickspacing(10); c.add(slider); setsize(300,100); setvisible(true); public static void main(string [] args) { new SliderEx();

JSlider Change 41 Change! JSlider (value) JSlider setvalue(int n) (value ) ChangeListener

11-15 : JSlider Change import javax.swing.*; import java.awt.*; import javax.swing.event.*; public class SliderChangeEx extends JFrame { private JLabel colorlabel; private JSlider [] sl = new JSlider [3]; public SliderChangeEx() { settitle(" ChangeEvent "); setdefaultcloseoperation(jframe.exit_on_close); Container c = getcontentpane(); c.setlayout(new FlowLayout()); colorlabel = new JLabel(" SLIDER EXAMPLE "); for(int i=0; i<sl.length; i++) { sl[i] = new JSlider(JSlider.HORIZONTAL, 0, 255, 128); sl[i].setpaintlabels(true); sl[i].setpaintticks(true); sl[i].setpainttrack(true); sl[i].setmajortickspacing(50); sl[i].setminortickspacing(10); sl[i].addchangelistener(new MyChangeListener()); c.add(sl[i]); sl[0].setforeground(color.red); sl[1].setforeground(color.green); sl[2].setforeground(color.blue); int r = sl[0].getvalue(); int g = sl[1].getvalue(); int b = sl[2].getvalue(); class MyChangeListener implements ChangeListener { public void statechanged(changeevent e) { int r = sl[0].getvalue(); int g = sl[1].getvalue(); int b = sl[2].getvalue(); colorlabel.setbackground(new Color(r,g,b)); public static void main(string [] args) { new SliderChangeEx(); 42 colorlabel.setopaque(true); colorlabel.setbackground(new Color(r,g,b)); c.add(colorlabel); setsize(300,230); setvisible(true);

43