NrTRuSH's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
New Members
Active Posts:
15 (0.03 per day)
Joined:
09-February 12
Profile Views:
266
Last Active:
User is offline Mar 01 2012 10:44 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   NrTRuSH has not set their status

Posts I've Made

  1. In Topic: Tabbed GUI for Farenheit to Celcius; Question on how to use GUI

    Posted 25 Feb 2012

    Thanks for trying atleast but im trying something right now. Ill post back if it works. First ill get all my stuff to work on one window and see if i can get that atleast. Right now i can click a button, have a input box popup and do it that way. Its not as nice as having a textbox (JTextField) and entering a value and clicking a button (Convert) and having the results popup.
  2. In Topic: Tabbed GUI for Farenheit to Celcius; Question on how to use GUI

    Posted 25 Feb 2012

    I am trying stuff. Its not like im sitting here waiting for an answer but im active duty military and going to college. I don't have my whole life to spend trying to learn this and i am trying. I keep testing things. My homework is done im trying to learn alittle something extra to make it better looking. All im trying to do is get some help once i have my tabs laid out adding things inside them. Maybe if you have a link to give me that will explain more then "You need to learn more". Im simply asking for some help which im sure anyone with as much knowledge as you could simply guide me in the right direction instead of just having smart ass comments. Sorry for asking for help on here. Ive searched the site for tutorials and have read the swings ones but once again they only show a piece of what i need. When i try to piece them together its still not working but im still working on it. Ill let you know when i fix it.
  3. In Topic: Tabbed GUI for Farenheit to Celcius; Question on how to use GUI

    Posted 25 Feb 2012

    Okay so now how do i add this into one of the tabs?

    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextField;
    
    /*
     * This program will do conversions
     */
    
    import javax.swing.*;
    import java.awt.event.*;
    
    public class conversionDEMO extends JFrame
    {
    	JPanel panel;
    	JButton convert;
    	JLabel msg;
    	JTextField txtfield;
    
    	public conversionDEMO()
    	{
    		// Sets the title of the frame
    
    		setTitle("Miles to Kilometers");
    
    		// Sets the size of the window
    
    		setSize(300, 400);
    
    		// Sets the action when window is close
    
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    		// Sets the visibility of the window
    
    		setVisible(true);
    
    		// Creates the panel
    
    		panel = new JPanel();
    
    		// Creates a label
    
    		msg = new JLabel("Please enter a distance in Miles: ");
    
    		// Creates the text field
    
    		txtfield = new JTextField(15);
    
    		// Creates the button
    
    		convert = new JButton("Convert");
    
    		// Adds to the panel
    
    		panel.add(msg);
    		panel.add(txtfield);
    		panel.add(convert);
    
    		// Add the panel to the content pane
    
    		add(panel);
    
    		// Creates the action listener
    
    		convert.addActionListener(new ButtonListener());
    
       }
    
    	// Handles the event if a button is clicked
    
    	public class ButtonListener implements ActionListener
       {
    		public void actionPerformed(ActionEvent e)
    		{
    			// If ok button is clicked, gets the input name
    
    			if(e.getSource()==convert)
    			{
    				// Gets the name from the text field
    
    				String name = txtfield.getText();
    
    				// If the text field is empty return a message
    
    				if(name.length() == 0)
    				{
    					JOptionPane.showMessageDialog(null, "You didn't enter anything");
    				}
    				else
    				{
    					
    					double miles = Double.parseDouble(name);
    					double newTemp = miles * 1.6;
    					
    					JOptionPane.showMessageDialog(null, "The distance of  " +  name + " Miles in Kilometers is " + newTemp + " Kilometers");
    					
    
    				}
    				txtfield.requestFocus();
    			}
    		}
    	}
    
    	public static void main(String[] args)
    	{	
    		new conversionDEMO();
    
    	}
    }
    
    
    
  4. In Topic: Tabbed GUI for Farenheit to Celcius; Question on how to use GUI

    Posted 25 Feb 2012

    How do i put the text box in there. I need to pack it into the window. I understand how to get the text from the textbox. Textbox is assinged a variable and i call that variable and parse it if needed from string to double. I just need to learn how to pack everything into one window. I can find help on adding a text box or adding a radio button but nothing combined together.

    I also have my code for each conversion already written. I want to make it nicer.

    
    /*
    	This class will take user input of the tempature Celcius and convert it into Fahrenheit.
    	It will then display the results in a Message Dialog window.
    	
    *
    */
    
    import javax.swing.*;
    
    public class celciusConversion
    {
    	public static void main(String[] args)
    	{
    		// Gets the tempature in Celcius
    		
    		String celTemp = JOptionPane.showInputDialog("Enter a tempature in Celcius");
    		
    		// Convert the Strings into a Double
    		
    		double celcius = Double.parseDouble(celTemp);
    		
    		// Output the sum into the screen
    		
    		double newTemp = celcius * 9/5 + 32;
    		
    		JOptionPane.showMessageDialog(null, "The tempature " + celcius + " Celcius converts to "  + newTemp + " degrees Fahrenheit");
    		
    	}
    
    }
    
    
    
  5. In Topic: Clock - Class Wrong and How to i display my variables in string

    Posted 21 Feb 2012

    I want to add:
    	public String normalTime()
    	{
    		return String.format("%02d:%02d:%02d %s", ((hour==0 || hour==12) ?12:hour%12), minute, second, (hour < 12? "AM" : "PM"));  // Set AM or PM. Also sets %02d (2 decimal places).
    	}
    
    


    But i dont know how to pull my hour, min, seconds variable from each class. e

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

NrTRuSH has no profile comments yet. Why not say hello?