<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Samet Kilictas's Blog &#187; Java</title>
	<atom:link href="http://samet.kilictas.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://samet.kilictas.com</link>
	<description>Personal E-Notebook</description>
	<lastBuildDate>Fri, 30 Apr 2010 07:29:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Example Code #2 &#8211; JOptionPane JCombobox</title>
		<link>http://samet.kilictas.com/example-code-2-joptionpane-jcombobox/</link>
		<comments>http://samet.kilictas.com/example-code-2-joptionpane-jcombobox/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 13:39:19 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[JComboBox]]></category>
		<category><![CDATA[JOptionPane]]></category>
		<category><![CDATA[showInputDialog]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=183</guid>
		<description><![CDATA[This code shows how to add ComboBox property to JOptionPane.showInputDialog. And the class is able to take an input from this combobox import javax.swing.JOptionPane; public class Options { public Options() { String smallList[] = {&#34;Sunday&#34;, &#34;Monday&#34;, &#34;Tuesday&#34;, &#34;Wednesday&#34;, &#34;Thrusday&#34;, &#34;Friday&#34;, &#34;Saturday&#34; }; String value = (String)JOptionPane.showInputDialog( null, &#34;What is your favourt day?&#34;, &#34;Which day?&#34;, JOptionPane.QUESTION_MESSAGE, [...]]]></description>
			<content:encoded><![CDATA[<p>This code shows how to add ComboBox property to JOptionPane.showInputDialog. And the class is able to take an input from this combobox</p>
<pre class="brush: java">
import javax.swing.JOptionPane;

public class Options {

	public Options() {

		String smallList[] = {&quot;Sunday&quot;, &quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;,
				&quot;Thrusday&quot;, &quot;Friday&quot;, &quot;Saturday&quot; };</pre>
<p><span id="more-183"></span></p>
<pre class="brush: java">
		String value = (String)JOptionPane.showInputDialog(
				null,
				&quot;What is your favourt day?&quot;,
				&quot;Which day?&quot;,
				JOptionPane.QUESTION_MESSAGE,
				null, // Use default icon
				smallList,
				smallList[smallList.length-1]);

		JOptionPane.showMessageDialog(null,
				&quot;Your favourit Day: &quot; + value);

	}
	public static void main(String[] args) {
		new Options();
	}

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/example-code-2-joptionpane-jcombobox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Example Code #1 &#8211; JOptionPane and ArrayList</title>
		<link>http://samet.kilictas.com/example-code-1-joptionpane-and-arraylist/</link>
		<comments>http://samet.kilictas.com/example-code-1-joptionpane-and-arraylist/#comments</comments>
		<pubDate>Sat, 20 Dec 2008 13:39:18 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ArrayList]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[JOptionPane]]></category>
		<category><![CDATA[showInputDialog]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=181</guid>
		<description><![CDATA[Here this class takes some values using JOptionPane.showInputDialog and shows them to the user using foreach loop import java.util.ArrayList; import javax.swing.JOptionPane; public class Confirm { ArrayList fruits = new ArrayList(); Confirm(){ String value = &#34;&#34;; while (true){ value = JOptionPane.showInputDialog(&#34;Which fruit to Add?&#34;); if (!value.equals(&#34;&#34;) ) { fruits.add(value); } else break; } for (String s [...]]]></description>
			<content:encoded><![CDATA[<p>Here this class takes some values using JOptionPane.showInputDialog and shows them to the user using foreach loop</p>
<p><a class="aligncenter" href="http://samet.kilictas.com/wp-content/uploads/2008/12/qwe1.jpg"><img class="alignnone size-full wp-image-185" title="Options" src="http://samet.kilictas.com/wp-content/uploads/2008/12/qwe1.jpg" alt="" width="305" height="131" /></a></p>
<pre class="brush: java">import java.util.ArrayList;
import javax.swing.JOptionPane;

public class Confirm {

ArrayList fruits = new ArrayList();

Confirm(){
String value = &quot;&quot;;
while (true){
value = JOptionPane.showInputDialog(&quot;Which fruit to Add?&quot;);
</pre>
<p><span id="more-181"></span></p>
<pre class="brush: java">
if (!value.equals(&quot;&quot;) )
{
fruits.add(value);
}
else
break;

}

for (String s : fruits) {
int n = JOptionPane.showConfirmDialog
(null,
s,
&quot;Apple list&quot;,
JOptionPane.YES_NO_OPTION);

System.out.println(&quot;n value:&quot; + n);

if (n == JOptionPane.YES_OPTION)
continue;
else if (n == JOptionPane.NO_OPTION)
break;
else if (n == JOptionPane.CLOSED_OPTION)
JOptionPane.showMessageDialog(null, &quot;you clicked to close&quot;);
}
}

public static void main(String[] args) {

new Confirm();

}

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/example-code-1-joptionpane-and-arraylist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java ActionListener Tutorial</title>
		<link>http://samet.kilictas.com/java-actionlistener-tutorial/</link>
		<comments>http://samet.kilictas.com/java-actionlistener-tutorial/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 08:47:18 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[ActionListener]]></category>
		<category><![CDATA[JComboBox]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=74</guid>
		<description><![CDATA[This tutorial has two classes. ActionListener and Main class are seperated from each other. ParamListener.java BtnsListener.java import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; /** * ParamListener.java */ public class ParamListener extends JFrame{ public ParamListener() { JButton btn10 = new JButton(&#34;10&#34;); JButton btn20 = new JButton(&#34;20&#34;); JButton btn30 = new JButton(&#34;30&#34;); JButton btn40 = new JButton(&#34;40&#34;); btn10.addActionListener( [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial has two classes. ActionListener and Main class are seperated from each other.</p>
<ul>
<li>ParamListener.java</li>
<li>BtnsListener.java</li>
</ul>
<p><a href="http://samet.kilictas.com/wp-content/uploads/2008/11/tut.jpg"><img class="alignnone size-full wp-image-75" title="tut" src="http://samet.kilictas.com/wp-content/uploads/2008/11/tut.jpg" alt="" width="269" height="178" /></a></p>
<pre class="brush: java">
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* ParamListener.java
*/
public class ParamListener extends JFrame{
public ParamListener() {
JButton btn10 = new JButton(&quot;10&quot;);
JButton btn20 = new JButton(&quot;20&quot;);
JButton btn30 = new JButton(&quot;30&quot;);
JButton btn40 = new JButton(&quot;40&quot;);

btn10.addActionListener( new BtnsListener (&quot;ten&quot;));
btn20.addActionListener( new BtnsListener (&quot;twenty&quot;));
btn30.addActionListener( new BtnsListener (&quot;thirty&quot;));
btn40.addActionListener( new BtnsListener (&quot;fourty&quot;));

JPanel content = new JPanel();
content.add(btn10);
content.add(btn20);
content.add(btn30);
content.add(btn40);

setContentPane(content);
setTitle(&quot;A Tutorial&quot;);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
pack();
}

public static void main(String[] args) {
new ParamListener();

}

}
</pre>
<p><span id="more-74"></span></p>
<pre class="brush: java">
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

/**
* BtnsListener.java
*/

class BtnsListener implements ActionListener{

String value = &quot;&quot;;
public BtnsListener(String pVal){
value = pVal;
}

@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, value);
}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/java-actionlistener-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java JCombobox Tutorial</title>
		<link>http://samet.kilictas.com/java-jcombobox-tutorial/</link>
		<comments>http://samet.kilictas.com/java-jcombobox-tutorial/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 08:20:41 +0000</pubDate>
		<dc:creator>Samet Kilictas</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JComboBox]]></category>
		<category><![CDATA[Swing]]></category>

		<guid isPermaLink="false">http://samet.kilictas.com/?p=68</guid>
		<description><![CDATA[This tiny program lets you to choose background color of your pane. import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class tut1 extends JFrame{ Color[] colors = { Color.RED, Color.BLUE, Color.YELLOW, Color.BLACK, Color.ORANGE, new Color(0,143,222) }; String[] renk = { &#34;red&#34;, &#34;blue&#34;, &#34;yellow&#34;, &#34;black&#34;, &#34;orange&#34;, &#34;turkuaz&#34; }; public [...]]]></description>
			<content:encoded><![CDATA[<p>This tiny program lets you to choose background color of your pane.</p>
<pre class="brush: java">
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class tut1 extends JFrame{

Color[] colors = {
Color.RED, Color.BLUE, Color.YELLOW, Color.BLACK, Color.ORANGE,
new Color(0,143,222)
};

String[] renk = {
&quot;red&quot;, &quot;blue&quot;, &quot;yellow&quot;, &quot;black&quot;, &quot;orange&quot;, &quot;turkuaz&quot;
};

public JComboBox cmb = new JComboBox(renk);
public JPanel main = new JPanel();

public tut1() {

cmb.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
int index = cmb.getSelectedIndex();
main.setBackground(colors[index]);
}
});
cmb.setBackground(Color.blue);

JLabel lbl = new JLabel();
main.add(cmb);
main.add(lbl);
setContentPane(main);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300,300);
setTitle(&quot;my title&quot;);
pack();
}
</pre>
<p><span id="more-68"></span></p>
<p>public static void main(String[] args) {<br />
tut1 window = new tut1();<br />
window.setVisible(true);</p>
<p>}</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://samet.kilictas.com/java-jcombobox-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
