<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest topics for the forum "Swing and AWT"]]></title>
		<link>http://forums.hotjoe.com/forums/show/14.page</link>
		<description><![CDATA[The newest discussed topics in the forum "Swing and AWT"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Problems With Image Display</title>
				<description><![CDATA[ Hi all.<br /> I'm trying to create an Image slide show.<br /> for those of you who knows "Objects First" book, I'm using the "Image Viewer" project there.<br /> <br /> I've created a JPanel then...<br /> <br /> So, I've created a new frame, and place an "Image Panel" object which is a Class from the book<br /> "public class ImagePanel extends JComponent"<br />  <br /> The class basically set up a place to put a Buffered Image object.<br /> <br /> The I've Added it to the JPanel andall is ok.<br /> <br /> The problem starts when I'm trying to add photos to the Panel..<br /> because I'm using pack(), the Window's changing it's size to the size of the new photo, but the picture is not displayed..<br /> <br /> here is the code.. I hope I managed to explain myself...<br /> <br /> Oh, also "ImageFileManager" is a class which checks if the file is a photo.<br /> <br /> <br /> [code]<br />   private static JFileChooser fileChooser = new JFileChooser(System.getProperty("user.dir"));<br />     private JFrame SlideShowFrame;<br />      private ImagePanel SlideShowImagePanel;<br />     int slideShowTime = 4;<br /> <br /> private void initializeSlideShow() {<br />                          <br />                 fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);<br />                 int returnVal = fileChooser.showOpenDialog(frame);<br /> <br />                 if(returnVal != JFileChooser.APPROVE_OPTION)<br />                     return;  <br />                 File[] fileList = fileChooser.getSelectedFile().listFiles();<br />                 makeSlideShow(fileList);<br />         <br />     <br />     }<br />     private void makeSlideShow(File[] fileList)<br />     {<br />         String fileName;<br />         OFImage currentSlideImage;<br />         makeSlideShowFrame();<br />         <br />         for (int i = 0; i &lt; fileList.length; i++)  {<br />                 currentSlideImage = ImageFileManager.loadImage(fileList[i]);<br />                 if (currentSlideImage != null) {<br />                     SlideShowImagePanel.setImage(currentSlideImage);<br />                     SlideShowFrame.pack();<br />                     try {Thread.sleep(slideShowTime * 1000); } catch (Exception e) {}<br />                 }<br /> <br />             }<br />         }<br />   private void  makeSlideShowFrame()<br />   {<br />       SlideShowFrame = new JFrame("Slide Show");<br />         JPanel contentPane = (JPanel)SlideShowFrame.getContentPane();<br />         contentPane.setBorder(new EmptyBorder(6, 6, 6, 6));<br /> <br />         contentPane.setLayout(new BorderLayout(6, 6));<br />         <br />         SlideShowImagePanel = new ImagePanel();<br />         SlideShowImagePanel.setBorder(new EtchedBorder());<br />         contentPane.add(SlideShowImagePanel, BorderLayout.CENTER);<br />        SlideShowFrame.pack();<br />         <br />         // place the frame at the center of the screen and show<br />         Dimension d = Toolkit.getDefaultToolkit().getScreenSize();<br />         SlideShowFrame.setLocation(d.width/2 - frame.getWidth()/2, d.height/2 - frame.getHeight()/2);<br />          SlideShowFrame.setVisible(true);<br />       <br />       <br />     }<br /> [/code]<br /> <br /> If someone is willing to take a look and tell me what's wrong I will appreciate it so much.<br /> <br /> thanks,<br /> <br /> Giora.]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/758/2760.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/758/2760.page</link>
				<pubDate><![CDATA[Thu, 24 Jun 2010 08:20:07]]> GMT</pubDate>
				<author><![CDATA[ gioravered]]></author>
			</item>
			<item>
				<title>Bilinear Interpolation Scaling help</title>
				<description><![CDATA[ Hi,<br /> <br /> I'm trying to program a class for a project, that reads a picture as BufferedImage, and resize it using Bilinear Interpolation  (Using the mathematical formulas, not the methods included in java). I almost sure that the Bilinear Interpolation part of the method is done, but after many thinking, searching and losing hope, I just can't figure out how to apply the scaling part to the method.<br /> <br /> Here's the method:<br /> <br /> [code]<br /> public static BufferedImage resize(BufferedImage image, int w2, int h2)<br /> {<br />  <br /> BufferedImage outputImage = new BufferedImage( w2, h2, BufferedImage.TYPE_INT_RGB );<br />  <br /> // Ratio between original picture and resized picture <br /> float x_ratio = ((float) (image.getWidth()-1))/w2 ; <br /> float y_ratio = ((float) (image.getHeight()-1))/h2;<br />  <br /> // Four pixels a,b,c,d int a, b, c, d, i, j, color; <br /> float alpha, beta, xabRed, xabGreen, xabBlue, xcdRed, xcdGreen, xcdBlue, xfinalRed, xfinalGreen, xfinalBlue; <br /> <br /> <br /> for (int x = 0; x &lt; image.getHeight()-1; x++) <br />    for( int y = 0; y &lt; image.getWidth()-1; y++){ <br /> <br /> //Find the color values of the 4 pixels around the desired point to interpolate <br />    a = image.getRGB(x, y); <br />    b = image.getRGB(x, y + 1); <br />    c = image.getRGB(x + 1, y); <br />    d = image.getRGB(x + 1, y + 1); <br /> <br />    i = (int) (x_ratio * x); <br />    j = (int) (y_ratio * y); <br /> <br />    alpha = (x_ratio * x) - i; <br />    beta = (y_ratio * y) - j; <br /> <br /> // a,b represents 2 of the 4 points for interpolation <br />    xabRed = alpha * ((b &gt;&gt; 16)&0xff) + (1 - alpha) * ((a &gt;&gt; 16)&0xff); <br />    xabGreen = alpha * ((b &gt;&gt; 8)&0xff) + (1 - alpha) * ((a &gt;&gt; 8)&0xff); <br />    xabBlue = alpha * (b &0xff) + (1 - alpha) * (a &0xff); <br /> <br /> // c,d represents 2 of the 4 points for interpolation <br />    xcdRed = alpha * ((d &gt;&gt; 16)&0xff) + (1 - alpha) * ((c &gt;&gt; 16)&0xff); <br />    xcdGreen = alpha * ((d &gt;&gt; 8)&0xff) + (1 - alpha) * ((c &gt;&gt; 8)&0xff); <br />    xcdBlue = alpha * (d &0xff) + (1 - alpha) * (c &0xff); <br /> <br /> // Desired point <br />    xfinalRed = beta * xcdRed + (1 - beta) * xabRed; <br />    xfinalGreen = beta * xcdGreen + (1 - beta) * xabGreen;      xfinalBlue = beta * xcdBlue + (1 - beta) * xabBlue; <br /> <br /> // Prints the RGB values, for bound confirmation    System.out.println((int) xfinalRed + " " + (int) xfinalGreen + " " + (int) xfinalBlue); <br /> <br /> // Sets the new color value for the pixel <br />    color = new Color((int)xfinalRed, (int)xfinalGreen, (int)xfinalBlue).getRGB(); <br /> <br /> // Set the pixel <br />    outputImage.setRGB(x, y, color); <br /> }<br />  return outputImage; <br /> }<br /> [/code] <br /> <br /> <br /> Thanks in advance]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/752/2747.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/752/2747.page</link>
				<pubDate><![CDATA[Mon, 14 Jun 2010 16:42:20]]> GMT</pubDate>
				<author><![CDATA[ Xpectro]]></author>
			</item>
			<item>
				<title>digital diary in java using gUI AND streams</title>
				<description><![CDATA[ digital diary in java using gUI AND streams]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/745/2730.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/745/2730.page</link>
				<pubDate><![CDATA[Sat, 15 May 2010 03:19:05]]> GMT</pubDate>
				<author><![CDATA[ my_humps007]]></author>
			</item>
			<item>
				<title>Database data won't fill up my JComboBox</title>
				<description><![CDATA[ I know this might seem like a simple query problem [and it probably is but not for me ].<br /> <br /> The problem is the following that using the DISTINCT method in the query does not remove the double data. I tried using DISTINCT only on gemeente, but then the data does not show up in my ComboBox.<br /> <br /> The point is is that I remove the double data from the gemeente column, which contains a bunch of towns and their postal codes. Then I need to list those towns in a ComboBox but applying DISTINCT to gemeente only works as a query in SQL, but then I do not see the data in my combobox.<br /> <br /> [code]<br /> public Vector&lt;jstageGemeente&gt; getjStageGemeente() {<br /> <br />         Statement stmt = null;<br />         ResultSet rs = null;<br />         jstageGemeente gemeente = null;<br />         Vector &lt;jstageGemeente&gt; resultaat = new Vector&lt;jstageGemeente&gt;();<br /> <br />         try {<br />             stmt = connection.createStatement();<br />             rs = stmt.executeQuery("SELECT DISTINCT id, postcode, gemeente FROM jstageGemeente ORDER BY gemeente");<br /> <br />             while (rs.next()) {<br />                 gemeente = new jstageGemeente();<br />                 gemeente.setId(rs.getInt(1));<br />                 gemeente.setPostcode(rs.getInt(2));<br />                 gemeente.setGemeente(rs.getString(3));<br />                 resultaat.add(gemeente);<br />             }<br />         }[/code]<br /> <br /> StudentFrame that loads the data into the combobox<br /> <br /> [code]<br /> public class StudentFrame extends JFrame implements ActionListener {<br /> <br />     private Container content;<br />     private JPanel topLeft, topRight, bottomLeft, bottomRight;<br />     private JComboBox gemeentenBox, sectorBox, soortBox;<br />     private JTextField aantalVeld;<br />     private JButton zoekenButton;<br /> <br />     private DAjstageLogin daLogin = null;<br />     private DAjstageBedrijf daBedrijf = null;<br />     private DAjstageGemeente daGemeente = null;<br />     private DAjstageKeuze daKeuze = null;<br />     private DAjstageSector daSector = null;<br />     private DAjstageSoort daSoort = null;<br />     private DAjstageStudent daStudent = null;<br />     private DAjstageOpdracht daOpdracht = null;<br /> <br />     public StudentFrame(DAjstageBedrijf daBedrijf, DAjstageKeuze daKeuze, DAjstageGemeente daGemeente, DAjstageSector daSector, DAjstageOpdracht daOpdracht, DAjstageSoort daSoort, DAjstageStudent daStudent, DAjstageLogin daLogin)<br />                     throws Exception {<br /> <br />         this.daGemeente = daGemeente;<br />         this.daSector = daSector;<br />         this.daOpdracht = daOpdracht;<br />         this.daStudent = daStudent;<br />         this.daKeuze = daKeuze;<br />         this.daLogin = daLogin;<br />         this.daSoort = daSoort;<br /> <br />         this.setLocation(150,150);<br />         setTitle("Welkom");<br />         setSize(1000,750);<br />         opbouwScherm();<br />         addWindowListener(new VensterHandler());<br />         setVisible(true);<br />         this.setResizable(false);<br /> <br />     }<br /> <br /> <br />     public void opbouwScherm(){<br />         content = getContentPane();<br />         content.setLayout(null);<br /> <br />         JComboBox gemeentenBox = new JComboBox(daGemeente.getjStageGemeente());<br />         gemeentenBox.insertItemAt("geen voorkeur", 0);<br />         JComboBox sectorBox = new JComboBox(daSector.getjStageSector());<br />         sectorBox.insertItemAt("geen voorkeur", 0);<br />         JComboBox soortBox = new JComboBox(daSoort.getjStageSoort());<br />         soortBox.insertItemAt("geen voorkeur", 0);<br />         JTextField aantalVeld = new JTextField();<br />         JButton zoekenButton = new JButton("Zoek");<br />         JLabel gemeentenLabel = new JLabel("Locatie bedrijf:");<br />         JLabel aantalLabel = new JLabel("Werkzame informatici:");<br />         JLabel sectorLabel = new JLabel("Sector stagebedrijf:");<br />         JLabel soortLabel = new JLabel("Soort stage:");<br /> <br />         //comboboxen<br />         gemeentenBox.setBounds(5, 30, 150, 20);<br />         sectorBox.setBounds(160, 30, 325, 20);<br />         soortBox.setBounds(495, 30, 140, 20);<br />         aantalVeld.setBounds(625, 30, 135, 20);<br /> <br />         //labels<br />         gemeentenLabel.setBounds(5,10,120,20);<br />         sectorLabel.setBounds(160,10,120,20);<br />         soortLabel.setBounds(495,10,120,20);<br />         aantalLabel.setBounds(625,10,135,20);<br /> <br />         //buttons<br />         zoekenButton.setBounds(800,30,80,20);<br /> <br />         content.add(gemeentenBox);<br />         content.add(sectorBox);<br />         content.add(soortBox);<br />         content.add(aantalVeld);<br />         content.add(gemeentenLabel);<br />         content.add(sectorLabel);<br />         content.add(soortLabel);<br />         content.add(aantalLabel);<br />         content.add(zoekenButton);<br /> <br />     }[/code]]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/744/2729.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/744/2729.page</link>
				<pubDate><![CDATA[Wed, 12 May 2010 14:23:28]]> GMT</pubDate>
				<author><![CDATA[ Subhero]]></author>
			</item>
			<item>
				<title>HELP PLEASE!- Paint Program Not &quot;Drawing&quot;</title>
				<description><![CDATA[ Hello, Please help. I have a paint program for school due tommorow, but it doesn't seem to be working. The code attached is a a smaller version of my program. Only the "Brush:Stroke" tool under "Brush" works in that program provided.<br /> <br /> I have a menubar on the top of the screen, which I made into a tools bar. There is also two panels attached in a borderlayout. One is the title, with a label "untitled", at the top, under the menubar, and the other is the panel that sets the colours and thickness etc at the bottom (set to "South"). When i select my brush:Stroke button, I'm supposed to be able to draw in the middle, since its a brush tool. The problem is that it doesn't show up, and the only way for it to show up is if I click and hold on a panel (using the tool), then dragging it into the centre draw area. For example, I select the brush:stroke tool under "brush" then inorder for me to draw, I have to click and hold onto a panel (lets say the bottom one) and drag it to the middle for it to show up. <br /> <br /> Can someone please help me? I really don't know what is wrong. This is due tommorow and I need urgent assistance, Thank You. <br /> <br /> [code]import java.applet.*;<br /> import java.awt.*;<br /> import java.awt.event.*;<br /> <br /> public class SketchPadHelp extends java.awt.Frame implements ActionListener<br /> {<br />     // Place instance variables here<br />     Menu objMenuFile;<br />     Menu objSeperator;<br />     Menu objMenuBrush;<br /> <br /> <br /> <br />     Color col = Color.black;  //stores the color of the paint brush<br />     Color col2 = Color.red;  //stores the color of the paint brush<br />     String brushStroke = "circleBrush";<br />     String shapeSelect = "none";<br />     Label sizeLabel = new Label ("Stroke Size:");<br />     TextField size = new TextField ("10");<br />     int radius = Integer.parseInt (size.getText ()); //Turns a string into an integer.<br /> <br />     Button blankButton = new Button (" ");<br />     Button blankButton2 = new Button (" ");<br />     // blankButton.setVisible (false);<br />     // blankButton2.setVisible (false);<br /> <br />     //ToolButtons<br />     Button boxButton = new Button ("Box");<br />     Button lineButton = new Button ("Line");<br />     Button brushButton = new Button ("Brush");<br />     Button ovalButton = new Button ("Oval");<br />     Button eraserButton = new Button ("Eraser");<br />     Button spraycanButton = new Button ("Spray");<br />     //ColourButtons<br />     Button fillButton = new Button ("  ");<br />     Button strokeButton = new Button ("  ");<br /> <br />     Button darkBlueButton = new Button ("  ");<br />     Button blueButton = new Button ("  ");<br />     Button lightBlueButton = new Button ("  ");<br /> <br />     Button darkRedButton = new Button ("  ");<br />     Button redButton = new Button ("  ");<br />     Button pinkButton = new Button ("  ");<br /> <br />     Button darkGreenButton = new Button ("  ");<br />     Button greenButton = new Button ("  ");<br />     Button lightGreenButton = new Button ("  ");<br /> <br />     Button darkYellowButton = new Button ("  ");<br />     Button yellowButton = new Button ("  ");<br />     Button lightYellowButton = new Button ("  ");<br /> <br />     Button darkBrownButton = new Button ("  ");<br />     Button brownButton = new Button ("  ");<br />     Button orangeButton = new Button ("  ");<br /> <br />     Button darkPurpleButton = new Button ("  ");<br />     Button purpleButton = new Button ("  ");<br />     Button lightPurpleButton = new Button ("  ");<br /> <br />     Button blackButton = new Button ("  ");<br />     Button greyButton = new Button ("  ");<br />     Button whiteButton = new Button ("  ");<br /> <br />     //LayoutSettings<br />     Label titleLabel = new Label ("Untitled");<br />     Panel colourPanel = new Panel ();<br />     Panel optionsPanel = new Panel ();<br />     Panel settingsPanel = new Panel ();<br />     Panel sizePanel = new Panel ();<br />     Panel fillTypePanel = new Panel ();<br />     Panel titlePanel = new Panel ();<br /> <br />     boolean drawBallOn = false;<br /> <br /> <br />     int x1, y1, x2, y2, oldx, oldy;        //These are the coordinates of the mouse when it is pressed<br />     //and x2,y2 are the coordinates where the mouse is released.<br />     <br />     protected void drawBall (Graphics g, int x, int y)  //this draws a ball on the screen<br />     {<br />         radius = Integer.parseInt (size.getText ()); //Turns a string into an integer.<br />         g.setColor (col);<br />         g.fillOval (x - radius, y - radius, 2 * radius, 2 * radius);<br />     }<br /> <br />     public boolean mouseDown (Event e, int x, int y)  //this method is called when the mouseis first pressed<br />     {<br /> <br /> <br />         x1 = x; //Save the coordinates incase you are drawing a box.<br />         y1 = y;<br /> <br />         Graphics g = getGraphics ();<br />         if (drawBallOn)     //If your drawing a ball do it here<br />         {<br />             drawBall (g, x, y);<br />         }<br /> <br /> <br />         return (true);<br />     }<br /> <br /> <br />     public boolean mouseDrag (Event e, int x, int y)  //this method is called every time the mouse is draged<br />     {<br />         x2 = x;     //save the position of the mouse<br />         y2 = y;<br />         Graphics g = getGraphics ();<br />         if (drawBallOn) //If we're drawing a ball do it here<br />         {<br />             drawBall (g, x, y);<br />         }<br /> <br /> <br />         return (true);<br />     }<br /> <br /> <br />     public void init ()<br />     {<br />         setBackground (Color.white);<br /> <br /> <br />         buildMenuFile ();<br />         buildMenuSeperator ();<br />     <br />         buildMenuBrush ();<br /> <br /> <br />         MenuBar objMenuBar = new MenuBar ();<br /> <br />         setMenuBar (objMenuBar);<br />         objMenuBar.add (objMenuFile);<br />         objMenuBar.add (objSeperator);<br />         objMenuBar.add (objMenuBrush);<br />   <br /> <br />         //TitlePanel<br />         titlePanel.add (titleLabel);<br /> <br />         //SettingsPanel<br />         optionsPanel.add (settingsPanel);<br />         optionsPanel.add (colourPanel);<br />         optionsPanel.setBackground (new Color (240, 240, 240));<br /> <br />         settingsPanel.setLayout (new GridLayout (1, 2));<br />         settingsPanel.add (sizePanel);<br />         settingsPanel.add (fillTypePanel);<br /> <br /> <br />         sizePanel.add (size);<br /> <br />         fillTypePanel.setLayout (new GridLayout (2, 1));<br />         fillTypePanel.add (strokeButton);<br />         fillTypePanel.add (fillButton);<br /> <br /> <br /> <br /> <br /> <br />         //ColourPanel<br />         colourPanel.setLayout (new GridLayout (3, 8));<br /> <br />         // blankButton.setBackground (Color.white); //set the blue buttons color to blue<br />         // colourPanel.add (blankButton);<br /> <br />         fillButton.setBackground (col2); //set the blue buttons color to blue<br />         strokeButton.setBackground (col); //set the blue buttons color to blue<br /> <br />         whiteButton.setBackground (Color.white); //set the blue buttons color to blue<br />         colourPanel.add (whiteButton);<br /> <br />         pinkButton.setBackground (new Color (225, 128, 128)); //set the blue buttons color to blue<br />         colourPanel.add (pinkButton);<br /> <br />         orangeButton.setBackground (new Color (255, 130, 4)); //set the blue buttons color to blue<br />         colourPanel.add (orangeButton);<br /> <br />         lightYellowButton.setBackground (new Color (225, 225, 128)); //set the blue buttons color to blue<br />         colourPanel.add (lightYellowButton);<br /> <br />         lightGreenButton.setBackground (new Color (128, 225, 128)); //set the blue buttons color to blue<br />         colourPanel.add (lightGreenButton);<br /> <br />         lightBlueButton.setBackground (new Color (121, 188, 255)); //set the blue buttons color to blue<br />         colourPanel.add (lightBlueButton);<br /> <br />         lightPurpleButton.setBackground (new Color (255, 196, 255)); //set the blue buttons color to blue<br />         colourPanel.add (lightPurpleButton);<br /> <br />         greyButton.setBackground (new Color (128, 128, 128)); //set the blue buttons color to blue<br />         colourPanel.add (greyButton);<br /> <br />         redButton.setBackground (Color.red); //set the blue buttons color to blue<br />         colourPanel.add (redButton);<br /> <br />         brownButton.setBackground (new Color (128, 64, 0)); //set the blue buttons color to blue<br />         colourPanel.add (brownButton);<br /> <br />         yellowButton.setBackground (Color.yellow); //set the blue buttons color to blue<br />         colourPanel.add (yellowButton);<br /> <br />         greenButton.setBackground (Color.green); //set the blue buttons color to blue<br />         colourPanel.add (greenButton);<br /> <br />         blueButton.setBackground (Color.blue); //set the blue buttons color to blue<br />         colourPanel.add (blueButton);<br /> <br />         purpleButton.setBackground (new Color (128, 0, 255)); //set the blue buttons color to blue<br />         colourPanel.add (purpleButton);<br /> <br />         blackButton.setBackground (Color.black); //set the blue buttons color to blue<br />         colourPanel.add (blackButton);<br /> <br />         darkRedButton.setBackground (new Color (128, 0, 0)); //set the blue buttons color to blue<br />         colourPanel.add (darkRedButton);<br /> <br />         darkBrownButton.setBackground (new Color (89, 45, 0)); //set the blue buttons color to blue<br />         colourPanel.add (darkBrownButton);<br /> <br />         darkYellowButton.setBackground (new Color (191, 191, 0)); //set the blue buttons color to blue<br />         colourPanel.add (darkYellowButton);<br /> <br />         darkGreenButton.setBackground (new Color (0, 128, 0)); //set the blue buttons color to blue<br />         colourPanel.add (darkGreenButton);<br /> <br />         darkBlueButton.setBackground (new Color (0, 0, 128)); //set the blue buttons color to blue<br />         colourPanel.add (darkBlueButton);<br /> <br />         darkPurpleButton.setBackground (new Color (64, 0, 128)); //set the blue buttons color to blue<br />         colourPanel.add (darkPurpleButton);<br /> <br />         //Layout<br />         setLayout (new BorderLayout ());<br />         add (optionsPanel, "South");<br />         add (titlePanel, "North");<br /> <br />     }<br /> <br /> <br />     public boolean action (Event e, Object o)  //Detemine what happens when a button is pressed<br />     {<br /> <br /> <br />         if (e.target == darkBlueButton) //if the blue button is pressed<br />         {<br />             col = (new Color (0, 0, 128)); //set the color to blue<br />         }<br />         if (e.target == blueButton) //if the blue button is pressed<br />         {<br />             col = Color.blue; //set the color to blue<br />         }<br />         if (e.target == lightBlueButton) //if the blue button is pressed<br />         {<br />             col = (new Color (121, 188, 255)); //set the color to blue<br />         }<br />         if (e.target == darkRedButton) //if the blue button is pressed<br />         {<br />             col = (new Color (128, 0, 0)); //set the color to blue<br />         }<br />         if (e.target == redButton) //if the blue button is pressed<br />         {<br />             col = Color.red; //set the color to blue<br />         }<br />         if (e.target == pinkButton) //if the blue button is pressed<br />         {<br />             col = (new Color (225, 128, 128)); //set the color to blue<br />         }<br />         if (e.target == darkGreenButton) //if the blue button is pressed<br />         {<br />             col = (new Color (0, 128, 0)); //set the color to blue<br />         }<br />         if (e.target == greenButton) //if the blue button is pressed<br />         {<br />             col = Color.green; //set the color to blue<br />         }<br />         if (e.target == lightGreenButton) //if the blue button is pressed<br />         {<br />             col = (new Color (128, 225, 128)); //set the color to blue<br />         }<br />         if (e.target == darkYellowButton) //if the blue button is pressed<br />         {<br />             col = (new Color (191, 191, 0)); //set the color to blue<br />         }<br />         if (e.target == yellowButton) //if the blue button is pressed<br />         {<br />             col = Color.yellow; //set the color to blue<br />         }<br />         if (e.target == lightYellowButton) //if the blue button is pressed<br />         {<br />             col = (new Color (225, 225, 128)); //set the color to blue<br />         }<br />         if (e.target == darkBrownButton) //if the blue button is pressed<br />         {<br />             col = (new Color (89, 45, 0)); //set the color to blue<br />         }<br />         if (e.target == brownButton) //if the blue button is pressed<br />         {<br />             col = (new Color (128, 64, 0)); //set the color to blue<br />         }<br />         if (e.target == orangeButton) //if the blue button is pressed<br />         {<br />             col = (new Color (255, 130, 4)); //set the color to blue<br />         }<br />         if (e.target == darkPurpleButton) //if the blue button is pressed<br />         {<br />             col = (new Color (64, 0, 128));  //set the color to blue<br />         }<br />         if (e.target == purpleButton) //if the blue button is pressed<br />         {<br />             col = (new Color (128, 0, 255));  //set the color to blue<br />         }<br />         if (e.target == lightPurpleButton) //if the blue button is pressed<br />         {<br />             col = (new Color (255, 196, 255));  //set the color to blue<br />         }<br />         if (e.target == blackButton) //if the blue button is pressed<br />         {<br />             col = Color.black;  //set the color to blue<br />         }<br />         if (e.target == whiteButton) //if the blue button is pressed<br />         {<br />             col = Color.white;  //set the color to blue<br />         }<br />         if (e.target == greyButton) //if the blue button is pressed<br />         {<br />             col = (new Color (128, 128, 128));  //set the color to blue<br />         }<br />         fillButton.setBackground (col2); //set the blue buttons color to blue<br />         strokeButton.setBackground (col); //set the blue buttons color to blue<br />         return (true);<br />     }<br /> <br /> <br /> <br />     public void paint (Graphics g)<br />     {<br /> <br /> <br /> <br />     } // paint method<br /> <br /> <br />     private void buildMenuFile ()<br />     {<br />         MenuItem objMenuItem;<br /> <br />         objMenuFile = new Menu ("File");<br /> <br />         objMenuItem = new MenuItem ("New");       //New<br />         objMenuItem.addActionListener (this);<br />         objMenuFile.add (objMenuItem);<br /> <br />         objMenuItem = new MenuItem ("Open");   //Open...<br />         objMenuItem.addActionListener (this);<br />         objMenuFile.add (objMenuItem);<br /> <br />         objMenuItem = new MenuItem ("Save");      //Save<br />         objMenuItem.addActionListener (this);<br />         objMenuFile.add (objMenuItem);<br /> <br />         objMenuItem = new MenuItem ("Save As"); //Save As...<br />         objMenuItem.addActionListener (this);<br />         objMenuFile.add (objMenuItem);<br /> <br />         objMenuFile.addSeparator ();          //add a horizontal separator line<br /> <br />         objMenuItem = new MenuItem ("Quit");      //Quit<br />         objMenuItem.addActionListener (this);<br />         objMenuFile.add (objMenuItem);<br />     }<br /> <br /> <br />     private void buildMenuSeperator ()<br />     {<br />         MenuItem objMenuItem;<br />         objSeperator = new Menu ("ll     ");<br />     }<br /> <br />     private void buildMenuBrush ()<br />     {<br />         MenuItem objMenuItem;<br /> <br />         objMenuBrush = new Menu ("Brush");<br /> <br />         objMenuItem = new MenuItem ("Brush:Round");<br />         objMenuItem.addActionListener (this);<br />         objMenuBrush.add (objMenuItem);<br /> <br />         objMenuItem = new MenuItem ("Brush:Square");<br />         objMenuItem.addActionListener (this);<br />         objMenuBrush.add (objMenuItem);<br /> <br />         objMenuItem = new MenuItem ("Brush:Caligraphy");<br />         objMenuItem.addActionListener (this);<br />         objMenuBrush.add (objMenuItem);<br />     }<br /> <br /> <br /> <br /> <br />     public void actionPerformed (ActionEvent event)<br />     {<br />         String strMenuName;<br /> <br />         strMenuName = event.getActionCommand ();<br /> <br />         if (strMenuName.equals ("Quit"))<br />         {<br />             System.exit (0);<br />         }<br /> <br />         if (strMenuName.equals ("Brush:Round"))<br />         {<br />            <br />             drawBallOn = true;<br />    <br />         }<br /> <br /> <br /> <br />     }<br /> <br /> <br />     public static void main (String args[])<br />     {<br />         SketchPadHelp objAppFrame = new SketchPadHelp ();<br /> <br />         objAppFrame.addWindowListener (     //Register an anonymous class as a listener.<br />                 new WindowAdapter ()<br />         {<br />             public void windowClosing (WindowEvent e)<br />             {<br />                 System.exit (0);<br />             }<br />         }<br />         );<br />         objAppFrame.setTitle ("SketchPad");<br />         objAppFrame.setSize (600, 600);                    //set Frame: width, height<br />         objAppFrame.init ();<br />         objAppFrame.setVisible (true);                     //Make frame visible. (replaces JDK 1.1's .show())<br /> <br />     } // main()<br /> } // Draw class[/code]]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/742/2726.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/742/2726.page</link>
				<pubDate><![CDATA[Mon, 10 May 2010 19:03:59]]> GMT</pubDate>
				<author><![CDATA[ SpagehtiSauce]]></author>
			</item>
			<item>
				<title>problem with Search function in GUI</title>
				<description><![CDATA[ Okay, so I am working on this program that I have been working on for a while, and I only need one more issue corrected before it is complete. My program displays multiple elements from an array in a GUI. Each element has several values such as name, number, and so on. I added a "Search" button and an empty editable text field so the user can use it to search.<br /> <br /> For example, I want to make it so I can type the name, click search and then have the GUI display the element according to the name searched for.<br /> <br /> Here is what I have for the text field:<br /> <br /> [code]<br />   t10 = new JTextField(20);<br />   t10.setToolTipText("Search For Item Name");<br />   t10.setEditable(true);<br />   t10.setText("");<br />   t10.setFont(font3);<br />   t10.setHorizontalAlignment(JTextField.CENTER);<br />   t10.setBackground(Color.WHITE);<br /> [/code]<br /> <br /> Here is what I have for the button so far:<br /> <br /> [code]<br />   asdButtons = new JButton[4];<br />   asdJPanel = new JPanel();<br />   asdJPanel.setLayout(new GridLayout(asdButtons.length,1));  // column of buttons<br />   asdButtons[0] = new JButton("Search"); <br />   asdButtons[0].addActionListener(<br />    new ActionListener(){<br /> 	   public void actionPerformed( ActionEvent e )<br /> 	    {<br /> 	    String searchKey = e.getActionCommand();<br />   }<br />  }<br /> );<br /> [/code]<br /> <br /> Finally, the array element that I want to search is the name, and I display it with:<br /> [code]<br /> setText(rb[index].name);<br /> [/code]<br /> <br /> I am completely lost and this and I would really appreciate any help or suggestions offered. I could really use a good point towards the right direction though.]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/702/2629.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/702/2629.page</link>
				<pubDate><![CDATA[Sun, 7 Mar 2010 19:44:11]]> GMT</pubDate>
				<author><![CDATA[ leapfrog7]]></author>
			</item>
			<item>
				<title>Quick Question on GUI Output</title>
				<description><![CDATA[ I have a quick question, I am just learning Java and in my current program I need to create a GUI. My code compiles and works just fine. But the line:<br /> <br /> [code]<br /> t5.setText(Double.toString(rb[index].Value()));<br /> [/code]<br /> <br /> Displays in the format:   2.4000000234<br /> <br /> How to I change this to display as currency so it shows: $2.40<br /> <br /> Value is a double, and when using the "System.out.printf" it displays just fine. Any help is greatly appreciated.]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/693/2609.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/693/2609.page</link>
				<pubDate><![CDATA[Sat, 20 Feb 2010 00:09:39]]> GMT</pubDate>
				<author><![CDATA[ leapfrog7]]></author>
			</item>
			<item>
				<title> hello i want to create gui program for my &quot;Language And Machines&quot; lesson : Turing machine project</title>
				<description><![CDATA[  hello i want to create gui program for my "Language And Machines" lesson : Turing machine project<br /> <br /> Our teacher says that GUI program should have this abilities:<br /> 1-user have a place on Gui that he can Create his standard Turing machine Graphicaly<br /> 2-when he double-click on state(a fill circle that has lable) of machine he can see list that he can select one them<br /> that then create a ARROW from this stat to another state<br /> 3-place that user inter his string (tape alphabetic of machin) graphicaly 4-click button then machin trace the machin graphicaly<br /> <br /> what component i should use for place that user can with drag and drop<br /> can create its state , arrow and other shapes?<br /> what component i should use for state ?<br /> what component i should use for arrow (my means thai is : -------------&gt; of course it have to be able to be arc-arrow)<br /> <br /> i am good in java but i weak in its Gui<br /> <br /> best regard. <br /> <br /> best regard.<br /> -------------------<br /> thanks but my means is other thing . i can create gui but for example for<br /> fill circle that labled and when click on it you see a list of item and this fill circle can moved and <br /> animate . what i should use ?<br /> this this applet i want to create enhanced thing like this but in application and not applet<br /> thanks all<br /> ----------------]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/683/2577.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/683/2577.page</link>
				<pubDate><![CDATA[Sun, 31 Jan 2010 03:27:19]]> GMT</pubDate>
				<author><![CDATA[ sunolinu]]></author>
			</item>
			<item>
				<title>Chess woes...</title>
				<description><![CDATA[ Hey, guys. I've been trying to program a graphical version of chess in Java. Everything has gone smoothly so far; I have a new game button, the app closes, and I've constructed the chess board. However, I cannot for the life of me figure out how to put the pictures of the pieces on the board. The code I have so far for my Board class is this:<br /> <br /> [code]public class Board extends JPanel implements ImageObserver{<br /> <br /> 	private static final int ROW = 8; <br /> 	private static final int COL = 8; <br /> 	private static final int WIDTH = 600;<br /> 	private static final Dimension SIZE = new Dimension(WIDTH,WIDTH);<br /> 	<br /> 	private static final Color dark = new Color(0x575757);<br /> 	private static final Color lite = new Color(0xE8E8E8);<br /> 	<br /> 	private int board[][] = new int[12][12]; //Internal representation of the board<br /> 	private Image pieces[] = new Image[17];<br /> 	<br /> 	public Board(){<br /> 		setPreferredSize(SIZE);<br /> 		<br /> 		pieces[1] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\whitePawn.gif")).getImage();<br /> 		pieces[2] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\whiteKnight.gif")).getImage();<br /> 		pieces[3] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\whiteBishop.gif")).getImage();<br /> 		pieces[4] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\whiteCastle.gif")).getImage();<br /> 		pieces[5] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\whiteQueen.gif")).getImage();<br /> 		pieces[6] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\whiteKing.gif")).getImage();<br /> 		<br /> 		pieces[11] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\blackPawn.gif")).getImage();<br /> 		pieces[12] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\blackKnight.gif")).getImage();<br /> 		pieces[13] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\blackBishop.gif")).getImage();<br /> 		pieces[14] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\blackCastle.gif")).getImage();<br /> 		pieces[15] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\blackQueen.gif")).getImage();<br /> 		pieces[16] = (new ImageIcon("C:\\Documents and Settings\\WKU Student\\Desktop\\Fall 2009\\Computer Science\\chessPieceImages\\blackKing.gif")).getImage();<br /> 	}<br /> 	<br /> 	public void newGame(){<br /> 		<br /> 		//Original board setup<br /> 		int original[][] = {{99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},<br /> 							{99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},<br /> 							{99, 99, 24, 22, 23, 25, 26, 23, 22, 24, 99, 99},<br /> 							{99, 99, 21, 21, 21, 21, 21, 21, 21, 21, 99, 99},<br /> 							{99, 99, 00, 00, 00, 00, 00, 00, 00, 00, 99, 99},<br /> 							{99, 99, 00, 00, 00, 00, 00, 00, 00, 00, 99, 99},<br /> 							{99, 99, 00, 00, 00, 00, 00, 00, 00, 00, 99, 99},<br /> 							{99, 99, 00, 00, 00, 00, 00, 00, 00, 00, 99, 99},<br /> 							{99, 99, 11, 11, 11, 11, 11, 11, 11, 11, 99, 99},<br /> 							{99, 99, 14, 12, 13, 15, 16, 13, 12, 14, 99, 99},<br /> 							{99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},<br /> 							{99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}};<br /> 		<br /> 		//Reset the board<br /> 		for(int row = 0; row &lt; 12; row++)<br /> 			for(int col = 0; col &lt; 12; col++)<br /> 				board[col][row] = original[col][row];<br /> 		<br /> 		//Update the board<br /> 		repaint();<br /> 	}<br /> 	<br /> 	protected void paintComponent(Graphics g){<br /> 		super.paintComponent(g);<br /> 		int panelWidth = getWidth();<br /> 		int panelHeight = getHeight();<br /> 		<br /> 		for(int row = 0; row &lt; ROW; row++){<br /> 			double height = (double) panelHeight / ROW;<br /> 			int y = (int)(height * row);<br /> 			<br /> 			for(int col = 0; col &lt; COL; col++){<br /> 				double width = (double) panelWidth / COL;<br /> 				int x = (int)(width * col);<br /> 				<br /> 				Color c = ((row % 2 == 0) ^ (col % 2 == 0)) ? lite : dark;<br /> 				g.setColor(c);<br /> 				g.fillRect(x, y, (int)width, (int)height);<br /> 				<br /> 				try{<br /> 					g.drawImage(pieces[board[x][y] - 10], x, y, this);<br /> 				} catch(ArrayIndexOutOfBoundsException e){}<br /> 			}<br /> 		}<br /> 	}<br /> 	<br /> 	private static void createAndShowUI(){<br /> 		JFrame frame = new JFrame("Java Chess");<br /> 		frame.getContentPane().add(new Board());<br /> 		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br /> 		frame.pack();<br /> 		frame.setLocationRelativeTo(null);<br /> 		frame.setVisible(true);<br /> 	}<br /> }[/code]<br /> <br /> Does anyone have any ideas on what I'm doing wrong? Or any other ideas on how I can get the images to load properly?]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/649/2444.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/649/2444.page</link>
				<pubDate><![CDATA[Sat, 28 Nov 2009 17:35:53]]> GMT</pubDate>
				<author><![CDATA[ DaGarver]]></author>
			</item>
			<item>
				<title>JFilechooser</title>
				<description><![CDATA[ I have a question regarding JFilechooser.<br /> <br /> If I enable drag, I can move files out of the jfilechooser to the file system or desktop - but what do I do, to be able to drag files from desktop or file system into a JFilechooser?]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/613/2337.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/613/2337.page</link>
				<pubDate><![CDATA[Tue, 1 Sep 2009 01:21:39]]> GMT</pubDate>
				<author><![CDATA[ Excubitor]]></author>
			</item>
			<item>
				<title>Need help making a SpaceInvaders game in Java</title>
				<description><![CDATA[ So here is my code:<br /> <br /> <br /> <br />  import java.awt.event.WindowAdapter;<br /> import java.awt.event.WindowEvent;<br /> import javax.swing.*;<br /> import javax.swing.JFrame;<br /> import java.awt.*;<br /> import javax.swing.JPanel;<br /> import java.awt.Canvas;<br /> import java.awt.Color;<br /> import java.awt.Dimension;<br /> import java.awt.Graphics;<br /> import java.awt.image.BufferedImage;<br /> import java.net.URL;<br /> import javax.imageio.ImageIO;<br />     <br />     public class invaders extends Canvas {<br />       public static final int Width = 800;<br />       public static final int Height = 600;<br />       <br />       public invaders() {<br />         JFrame openspace = new JFrame("Space Invaders");<br /> <br />         JPanel window = (JPanel)openspace.getContentPane();<br />         setBounds(0,0,Width,Height);<br />         window.setPreferredSize(new Dimension(Width,Height));<br />         window.setLayout(null);<br />         window.add(this);<br /> <br />         openspace.setBounds(0,0,Width,Height);<br />         openspace.setVisible(true);<br />         openspace.addWindowListener( new WindowAdapter() {<br />           public void windowClosing(WindowEvent e) {<br />             System.exit(0);<br />           }<br />         });<br />       }<br />       <br />      <br />       public void paint(Graphics graph) {<br />        // graph.setColor(Color.red);<br />        // graph.fillOval( Width/2-10, Height/2-10,20,20);<br />       // spacealien = loadImage("spaceAlien.jpg");<br />       // graph.drawImage(spaceAlien, 50, 50, this);<br />       }<br />       <br /> <br />       public static void main(String[] args) {<br />         invaders spaceinvaders = new invaders();<br />      }<br />    }<br />     <br /> <br /> <br /> <br /> I am trying to add pictures into the JFrame but I don't know how. I am following this tutorial <a class="snap_shots" href="http://www.planetalia.com/cursos/Java-Invaders/JAVA-INVADERS-04.tutorial" target="_blank" rel="nofollow">http://www.planetalia.com/cursos/Java-Invaders/JAVA-INVADERS-04.tutorial</a> but I get confused when they talk about how to add in an image. <br /> This is their Code:<br /> <br /> <br /> <br /> 1     package version04;<br /> 2     /**<br /> 3      * Curso B?sico de desarrollo de Juegos en Java - Invaders<br /> 4      * <br /> 5      * (c) 2004 Planetalia S.L. - Todos los derechos reservados. Prohibida su reproducci?n<br /> 6      * <br /> 7      * <a class="snap_shots" href="http://www.planetalia.com" target="_blank" rel="nofollow">http://www.planetalia.com</a><br /> 8      * <br /> 9      */<br /> 10    <br /> 11    <br /> 12    import java.awt.Canvas;<br /> 13    import java.awt.Dimension;<br /> 14    import java.awt.Graphics;<br /> 15    import java.awt.event.WindowAdapter;<br /> 16    import java.awt.event.WindowEvent;<br /> 17    import java.awt.image.BufferedImage;<br /> 18    import java.net.URL;<br /> 19    <br /> 20    import javax.imageio.ImageIO;<br /> 21    import javax.swing.JFrame;<br /> 22    import javax.swing.JPanel;<br /> 23    <br /> 24    public class Invaders extends Canvas {<br /> 25      public static final int WIDTH = 800;<br /> 26      public static final int HEIGHT = 600;<br /> 27      <br /> 28      <br /> 29      public Invaders() {<br /> 30        JFrame ventana = new JFrame("Invaders");<br /> 31        JPanel panel = (JPanel)ventana.getContentPane();<br /> 32        setBounds(0,0,WIDTH,HEIGHT);<br /> 33        panel.setPreferredSize(new Dimension(WIDTH,HEIGHT));<br /> 34        panel.setLayout(null);<br /> 35        panel.add(this);<br /> 36        ventana.setBounds(0,0,WIDTH,HEIGHT);<br /> 37        ventana.setVisible(true);<br /> 38        ventana.addWindowListener( new WindowAdapter() {<br /> 39          public void windowClosing(WindowEvent e) {<br /> 40            System.exit(0);<br /> 41          }<br /> 42        });<br /> 43      }<br /> 44      <br /> 45      public BufferedImage loadImage(String nombre) {<br /> <br /> 46        URL url=null;<br /> 47        try {<br /> 48          url = getClass().getClassLoader().getResource(nombre);<br /> 49          return ImageIO.read(url);<br /> 50        } catch (Exception e) {<br /> 51          System.out.println("No se pudo cargar la imagen " + nombre +" de "+url);<br /> 52          System.out.println("El error fue : "+e.getClass().getName()+" "+e.getMessage());<br /> 53          System.exit(0);<br /> 54          return null;<br /> 55        }<br /> 56      }<br /> 57      <br /> 58      <br /> <br /> 59      public void paint(Graphics g) {<br /> 60        BufferedImage bicho = loadImage("res/bicho.gif");<br /> <br /> 61        g.drawImage(bicho, 40, 40,this);<br /> <br /> 62      }<br /> 63      <br /> 64      public static void main(String[] args) {<br /> 65        Invaders inv = new Invaders();<br /> 66      }<br /> 67    }<br /> 68    <br /> <br /> <br /> <br /> <br /> I know there must be an easier way. Please help, thanks!!!!]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/593/2305.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/593/2305.page</link>
				<pubDate><![CDATA[Tue, 2 Jun 2009 19:34:27]]> GMT</pubDate>
				<author><![CDATA[ AFANDANGL3R]]></author>
			</item>
			<item>
				<title>Look n feel is not retained</title>
				<description><![CDATA[ I have used the following lines of code just after the beginning of my constructor.But my look n feel is not being set.AND WHY IS THE LOOK N FEEL BEING SET "MOTIF" by DEFAULT. And it is happening after I installed jdk6 update 13. How can I get default metal look.<br /> Is there any wrong with my code. Where should I put the code-in main method?<br /> [code]try {<br />         //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");<br />         UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());<br /> <br /> 			    } catch (InstantiationException e) {<br /> 			    } catch (ClassNotFoundException e) {<br /> 			    } catch (UnsupportedLookAndFeelException e) {<br /> 			    } catch (IllegalAccessException e) {    }<br /> 	SwingUtilities.updateComponentTreeUI(frame);<br /> 	frame.pack();[/code]]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/576/2257.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/576/2257.page</link>
				<pubDate><![CDATA[Wed, 22 Apr 2009 14:11:57]]> GMT</pubDate>
				<author><![CDATA[ tanvirtonu]]></author>
			</item>
			<item>
				<title>Dialog not reflecting new values</title>
				<description><![CDATA[ <br /> Hi,<br /> <br /> I have a problem in swings as follows<br /> I have an application which has a tab1 which contains a Jtable.On clicking a cell in Jtable a JDialog appears showing some more info on the cell clicked.<br /> <br /> In clearer terms this is what i would like to do<br /> <br /> Steps:<br /> - After running the below code you get a 3 buttons Lookup1,Lookup2 and Refresh and also 2 tabs with two different Jtables.<br /> - When i press the first tab and say Lookup1 the tab1-&gt;table loads.<br /> - Right click on a row, a dialog1 comes showing first coloumn data of the row.<br /> - Now go to tab2 and press Lookup1 button tab2-&gt;table loads,repeat the above step another dialog2 appears.<br /> - Now i press Refresh button the table's only load and dialog remains same.<br /> - Now again when i go to tab1-table and right click on a row the corresponding dialogs contain the old value and do not reflect new value.<br /> I want the last point to happen...????<br /> Please help me in tweaking the code.<br /> <br /> [code]package filthyrichclientsdemo;<br /> <br /> /**<br />  * @author K<br />  *<br />  */<br /> <br /> import javax.swing.*;<br /> <br /> import java.awt.*;<br /> import java.awt.event.*;<br /> import java.util.*;<br /> <br /> import javax.swing.event.TableModelEvent;<br /> import javax.swing.table.*;<br /> <br /> public class TestJava extends JFrame {<br /> 	DefaultTableModel mtm;<br /> 	<br /> 	DefaultTableModel mtm2;<br /> 	<br /> 	//boolean b1 =true;	<br /> <br /> 	JTabbedPane tabbedPane = new JTabbedPane();<br /> 	<br /> 	//JTabbedPane tabbedPane2 = new JTabbedPane();<br /> 	<br /> <br /> 	JPanel phones = new JPanel();<br /> 	<br /> 	JPanel phones2 = new JPanel();<br /> 	<br /> 	JScrollPane scroller = new JScrollPane();<br /> 	JScrollPane scroller2 = new JScrollPane();<br /> <br /> 	JPanel p = new JPanel(new BorderLayout());<br /> <br /> 	//JPanel p2 = new JPanel(new BorderLayout());<br /> 	<br /> 	JPanel topPanel = new JPanel();<br /> <br /> 	JButton lookup = new JButton("Lookup");<br /> 	<br /> 	JButton lookup1 = new JButton("Lookup1");<br /> 	<br /> 	//JButton lookup2 = new JButton("Lookup2");<br /> 	<br /> 	JButton refresh = new JButton("Refresh");<br /> <br /> 	JTable table = new JTable();<br /> 	<br /> 	JTable table2 = new JTable();<br /> 	<br /> 	<br /> <br /> 	Dbi di;<br /> 	Dbi2 di2;<br /> 	<br /> 	<br /> <br /> 	String[] columnNames = { "full name", "HP-URL", "address" };<br /> 	<br /> 	<br /> 	<br /> <br /> 	Vector cnv;<br /> 	<br /> 	<br /> 	<br /> <br /> 	Vector dbResult;<br /> 	<br /> 	<br /> <br /> 	public TestJava() {<br /> 		setDefaultCloseOperation(EXIT_ON_CLOSE);<br /> <br /> 		mtm = new DefaultTableModel(columnNames, 2);<br /> 		<br /> 		mtm2 = new DefaultTableModel(columnNames, 2);<br /> 		<br /> 		cnv = new Vector&lt;String&gt;(Arrays.asList(columnNames));<br /> 		<br /> 		table = new JTable(mtm);<br /> 		table2 =  new JTable(mtm2);<br /> 		<br /> 		<br /> 		final JOptionPane pane = new JOptionPane("", JOptionPane.PLAIN_MESSAGE,<br /> 				JOptionPane.INFORMATION_MESSAGE);<br /> <br /> 		final JDialog d = pane.createDialog(null, "Shakin'!");<br /> 		d.setModal(false);<br /> 		d.pack();<br /> 		table.addMouseListener(new MouseAdapter() {<br /> 			public void mouseClicked(MouseEvent me) {<br /> 				if (me.getButton() == me.BUTTON3) {<br /> 					int row = table.rowAtPoint(me.getPoint());<br /> 					Object value1 = table.getValueAt(row, 0);<br /> 					// JOptionPane.showInputDialog(value1,"Value is " + row);<br /> 					pane.setMessage(value1);<br /> 					if (!d.isVisible())<br /> 						d.setVisible(true);<br /> <br /> 				}<br /> 			}<br /> 		});<br /> 		final JOptionPane pane2 = new JOptionPane("", JOptionPane.PLAIN_MESSAGE,<br /> 				JOptionPane.INFORMATION_MESSAGE);<br /> <br /> 		final JDialog d2 = pane2.createDialog(null, "Shakin'!");<br /> 		d2.setModal(false);<br /> 		d2.pack();<br /> 		<br /> 		table2.addMouseListener(new MouseAdapter() {<br /> 			public void mouseClicked(MouseEvent me2) {<br /> 				if (me2.getButton() == me2.BUTTON3) {<br /> 					int row = table2.rowAtPoint(me2.getPoint());<br /> 					Object value1 = table2.getValueAt(row, 0);<br /> 					// JOptionPane.showInputDialog(value1,"Value is " + row);<br /> 					pane2.setMessage(value1);<br /> 					if (!d2.isVisible())<br /> 						d2.setVisible(true);<br /> <br /> 				}<br /> 			}<br /> 		});<br /> 		scroller = new JScrollPane(table);<br /> 		scroller2 = new JScrollPane(table2);<br /> <br /> 		topPanel.add(lookup);<br /> 		//topPanel.add(lookup2);<br /> 		topPanel.add(lookup1);<br /> 		topPanel.add(refresh);<br /> 		phones.add(scroller);<br /> 		phones2.add(scroller2);<br /> 		tabbedPane.addTab("Phones", phones);<br /> 		tabbedPane.addTab("Phones2", phones2);<br /> <br /> 		p.add(topPanel, BorderLayout.NORTH);<br /> 		p.add(tabbedPane, BorderLayout.CENTER);<br /> 		//p.add(tabbedPane, BorderLayout.CENTER);<br /> <br /> 		setContentPane(p);<br /> <br /> 		pack();<br /> <br /> 		di = new Dbi();<br /> 		<br /> 		di2= new Dbi2();<br /> 		<br /> 		refresh.addActionListener(new ActionListener(){<br /> 			public void actionPerformed(ActionEvent ae){<br /> 				JTabbedPane tabbedPane = new JTabbedPane();<br /> 				JPanel phones = new JPanel();<br /> 				JPanel phones2 = new JPanel();<br /> 				mtm = new DefaultTableModel(columnNames, 2);<br /> 				mtm2 = new DefaultTableModel(columnNames, 2);<br /> 				JTable table = new JTable();<br /> 				JTable table2 = new JTable();<br /> 				table =  new JTable(mtm);<br /> 				table2 =  new JTable(mtm2);<br /> 				//JPanel phones = new JPanel();<br /> 				JScrollPane scroller = new JScrollPane();<br /> 				JScrollPane scroller2 = new JScrollPane();<br /> 				JPanel p = new JPanel(new BorderLayout());<br /> 				JPanel topPanel = new JPanel();<br /> 				JButton lookup = new JButton("Lookup");<br /> 				JButton lookup1 = new JButton("Lookup1");<br /> 				scroller = new JScrollPane(table);<br /> 				scroller2 = new JScrollPane(table2);<br /> 				topPanel.add(lookup);<br /> 				topPanel.add(lookup1);<br /> 				phones.add(scroller);<br /> 				phones2.add(scroller2);<br /> 				tabbedPane.addTab("Phones", phones);<br /> 				tabbedPane.addTab("Phones2", phones2);<br /> 				p.add(topPanel, BorderLayout.NORTH);<br /> 				p.add(tabbedPane, BorderLayout.CENTER);<br /> 				setContentPane(p);<br /> 				pack();<br /> 				di = new Dbi();<br /> 				di2 = new Dbi2();<br /> 				fetch();<br /> 				fetch2();<br /> 				<br /> 				<br /> 				/*table.tableChanged(new TableModelEvent(table.getModel()));<br /> 				if (pane != null) {<br /> 					pane.setMessage("");<br /> 				}<br /> 				table.repaint();<br /> 				table2.tableChanged(new TableModelEvent(table2.getModel()));<br /> 				if (pane2 != null) {<br /> 					pane2.setMessage("");<br /> 				}<br /> 				table2.repaint();*/<br /> 			}<br /> 			<br /> 			<br /> 		});<br /> 			<br /> <br /> 		lookup.addActionListener(new ActionListener() {<br /> 			public void actionPerformed(ActionEvent e) {<br /> 				/*if(b1!= true){<br /> 					System.out.println("Coming");<br /> 					<br /> 					JTabbedPane tabbedPane = new JTabbedPane();<br /> 					JPanel phones = new JPanel();<br /> 					mtm = new DefaultTableModel(columnNames, 2);<br /> 					JTable table = new JTable();<br /> 					table =  new JTable(mtm);<br /> 					//JPanel phones = new JPanel();<br /> 					JScrollPane scroller = new JScrollPane();<br /> 					JPanel p = new JPanel(new BorderLayout());<br /> 					JPanel topPanel = new JPanel();<br /> 					JButton lookup = new JButton("Lookup");<br /> 					scroller = new JScrollPane(table);<br /> 					topPanel.add(lookup);<br /> 					phones.add(scroller);<br /> 					tabbedPane.addTab("Phones", phones);<br /> 					p.add(topPanel, BorderLayout.NORTH);<br /> 					p.add(tabbedPane, BorderLayout.CENTER);<br /> 					setContentPane(p);<br /> 					pack();<br /> 					di = new Dbi();<br /> 					fetch();<br /> 					if (pane != null) {<br /> 						pane.setMessage("");<br /> 					}<br /> 					table.repaint();<br /> 					<br /> 					b1=true;<br /> 					System.out.println("Going");<br /> 				}*/<br /> 				fetch();<br /> 				table.tableChanged(new TableModelEvent(table.getModel()));<br /> 				if (pane != null) {<br /> 					pane.setMessage("");<br /> 				}<br /> 				table.repaint();<br /> 				//table.setModel(new DefaultTableModel(0, 0));<br /> 				//b1=false;<br /> 				<br /> 				<br /> <br /> 			}<br /> 		});<br /> 		<br /> 		lookup1.addActionListener(new ActionListener() {<br /> 			public void actionPerformed(ActionEvent e) {<br /> 				fetch2();<br /> 				table2.tableChanged(new TableModelEvent(table2.getModel()));<br /> 				if (pane2 != null) {<br /> 					pane2.setMessage("");<br /> 				}<br /> 				table2.repaint();<br /> 				//table.setModel(new DefaultTableModel(0, 0));<br /> 				<br /> 				<br /> <br /> 			}<br /> 		});<br /> 		<br /> 		/*lookup2.addActionListener(new ActionListener() {<br /> 			public void actionPerformed(ActionEvent e) {<br /> 				 int numRows = table.getRowCount();<br /> 		            int numCols = table.getColumnCount();<br /> 		            javax.swing.table.TableModel model = table.getModel();<br /> <br /> 		            for (int i=0; i &lt; numRows; i++)<br /> 		       {<br /> 		                for (int j=0; j &lt; numCols; j++)<br /> 		           {<br /> 		                    model.setValueAt(null, i, j);<br /> 		                }<br /> 		            }<br /> 				<br /> 			}<br /> 		});*/<br /> 		<br /> 		<br /> 		<br /> 		<br /> <br /> 	}<br /> 	<br /> 	<br /> 	<br /> <br /> <br /> 	<br /> <br /> 	public void fetch() { // time-consuming task should be run<br /> 		Thread t = new Thread() { // in a separate thread<br /> 			public void run() {<br /> 				dbResult = di.getQueryResult("QUERY!!!!!");<br /> 				<br /> 				mtm.setDataVector(dbResult, cnv);<br /> 			}<br /> 		};<br /> 		t.start(); // actionPerformed() immediately returns, not blocking GUI<br /> 	}<br /> 	<br /> 	public void fetch2() { // time-consuming task should be run<br /> 		Thread t = new Thread() { // in a separate thread<br /> 			public void run() {<br /> 				dbResult = di2.getQueryResult("QUERY!!!!!");<br /> 				<br /> 				mtm2.setDataVector(dbResult, cnv);<br /> 			}<br /> 		};<br /> 		t.start(); // actionPerformed() immediately returns, not blocking GUI<br /> 	}<br /> <br /> 	public static void main(String[] args) {<br /> 		TestJava frame = new TestJava();<br /> 		frame.setVisible(true);<br /> 		<br /> <br /> 	}<br /> 	<br /> 	<br /> }<br /> <br /> class Dbi{ // make it a separate public class<br /> <br /> 	// meaningfull constructors, db connecton etc.<br /> 	// ...<br /> 	// ...<br /> <br /> 	public Vector&lt;Vector&gt; getQueryResult(String query) {<br /> <br /> 		Vector&lt;String&gt; v1 = new Vector&lt;String&gt;();<br /> 		Vector&lt;String&gt; v2 = new Vector&lt;String&gt;();<br /> 		Vector&lt;String&gt; v3 = new Vector&lt;String&gt;();<br /> 		Vector&lt;String&gt; v4 = new Vector&lt;String&gt;();<br /> <br /> 		v1.addAll(Arrays.asList(new String[] { "Tim Marshall",<br /> 				"http://tim.marshall/", "Never never land" }));<br /> 		v2.addAll(Arrays.asList(new String[] { "Com Commercial",<br /> 				"http://com.comcom/", "Land of gold" }));<br /> 		v3.addAll(Arrays.asList(new String[] { "Love Lovable",<br /> 				"http://love.neverhate/", "Sun lotus state" }));<br /> 		v4.addAll(Arrays.asList(new String[] { "War Monger",<br /> 				"http://war.momongers/", "Fire and ice city" }));<br /> <br /> 		Vector&lt;Vector&gt; v0 = new Vector&lt;Vector&gt;();<br /> 		v0.add(v1);<br /> 		v0.add(v2);<br /> 		v0.add(v3);<br /> 		v0.add(v4);<br /> 		return v0;<br /> 	}<br /> <br /> 	<br /> 	// other important methods<br /> 	// ...<br /> 	// ...<br /> <br /> 	<br /> }<br /> <br /> class Dbi2{ // make it a separate public class<br /> <br /> 	// meaningfull constructors, db connecton etc.<br /> 	// ...<br /> 	// ...<br /> <br /> 	public Vector&lt;Vector&gt; getQueryResult(String query) {<br /> <br /> 		Vector&lt;String&gt; v1 = new Vector&lt;String&gt;();<br /> 		Vector&lt;String&gt; v2 = new Vector&lt;String&gt;();<br /> 		Vector&lt;String&gt; v3 = new Vector&lt;String&gt;();<br /> 		Vector&lt;String&gt; v4 = new Vector&lt;String&gt;();<br /> <br /> 		v1.addAll(Arrays.asList(new String[] { "Ran Rand",<br /> 				"http://tim.marshall/", "Never never land" }));<br /> 		v2.addAll(Arrays.asList(new String[] { "Jim Corbet",<br /> 				"http://com.comcom/", "Land of gold" }));<br /> 		v3.addAll(Arrays.asList(new String[] { "Ram Jim",<br /> 				"http://love.neverhate/", "Sun lotus state" }));<br /> 		v4.addAll(Arrays.asList(new String[] { "Click Thick",<br /> 				"http://war.momongers/", "Fire and ice city" }));<br /> <br /> 		Vector&lt;Vector&gt; v0 = new Vector&lt;Vector&gt;();<br /> 		v0.add(v1);<br /> 		v0.add(v2);<br /> 		v0.add(v3);<br /> 		v0.add(v4);<br /> 		return v0;<br /> 	}<br /> <br /> }<br /> <br /> 	<br /> 	<br /> <br /> [/code]<br /> <br /> Thanks]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/554/2086.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/554/2086.page</link>
				<pubDate><![CDATA[Thu, 5 Mar 2009 10:14:52]]> GMT</pubDate>
				<author><![CDATA[ karl]]></author>
			</item>
			<item>
				<title>Plzz guide me </title>
				<description><![CDATA[ My midterm exams are over. But i couln't solve a question there. Plz guide what might be the exact solution of the task?<br /> [B]Question:[/B][list]<br />  <br /> You are required to develop a simple GUI based database driven application.<br /> Core Tasks:-<br /> (i) Building database <br /> (ii) Connect to database<br /> (iii)Query the database <br /> (iv) Display result in proper format <br /> [B]Tasks Details:[/B][<br /> Use MS Access to create database with the name “DATESHEET” and add a<br /> table to it with name “STUDENT”.<br /> Your table should have following fields.<br /> rollNo<br /> studentName<br /> city<br /> degreeProgram<br /> courseID<br /> sessionID<br /> date<br /> time<br /> (i) Enter at least 20 records in the table.<br /> (ii) Create a System DSN with the name “studentDSN”.<br /> (iii) Build a simple GUI based program which will connect to this database<br /> and query all the records in the “STUDENT” table and display them.<br /> (iv) Use Grid Layout to display the records.<br /> (v) You should use Jlabel in every cell of the grid layout to display a field from<br /> table.<br /> (vi) Also add a header row in the layout which would contain the names of the<br /> fields. (Use hard coded names of table fields, do not use meta data)<br /> (vii) Marks will be deducted if any student does not use the same names<br /> (database, table and System DSN) as told above.<br /> (viii)  Exceptions Handling related to DB should be handled properly.<br /> (ix) Code should be nicely aligned and well commented where required.<br /> (x) Also don’t forget to submit your database along with your code.<br /> ]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/525/2002.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/525/2002.page</link>
				<pubDate><![CDATA[Thu, 13 Nov 2008 01:14:04]]> GMT</pubDate>
				<author><![CDATA[ touseef4pk]]></author>
			</item>
			<item>
				<title>Can Java be used to Make Mobile Phone Spywares?</title>
				<description><![CDATA[ One person (A lecturer in an ordinary institue) told us,that he can develop a mobile phone spyware that sends him a copy of each and every SMS  that the mobile phone owner sends to someone else.I wondered having heard that java can be used to develop Virus kind of programs,(even if I have heard that it can be done with C++).<br /> <br /> I'm a JAVA Fan,and a student. I like if java can have the all abilities to do anything.But I'm not sure how can someone develop a Virus,Malware or Spyware to a Mobile Phone with java.<br /> <br /> If it is possible,how can it be done?<br /> Can we infiltrate the OS(Such as symbian) of Mobile phone? I really don't want to develop malwares.But I just want to know whether we can do that with java.Because as I'm still a JAVA student, I need to know whether I have missed something while learning.<br /> <br /> If it can't be done,please tell me the reason.Because that person has lied us lot of times to make us not leaving their institute.If that person tells me again the guys who support me with forum are wrong, I must have the knowledge to talk about this matter.]]></description>
				<guid isPermaLink="true">http://forums.hotjoe.com/posts/preList/508/1947.page</guid>
				<link>http://forums.hotjoe.com/posts/preList/508/1947.page</link>
				<pubDate><![CDATA[Thu, 16 Oct 2008 03:11:11]]> GMT</pubDate>
				<author><![CDATA[ intruderX]]></author>
			</item>
	</channel>
</rss>