Click here to Skip to main content
15,885,914 members
Home / Discussions / Java
   

Java

 
AnswerRe: Java Best Solution For SOA Pin
Richard MacCutchan30-Aug-15 20:39
mveRichard MacCutchan30-Aug-15 20:39 
Questionwhat is the best tools can I use it to write Java code for Android Applications Pin
Member 1194108927-Aug-15 10:25
Member 1194108927-Aug-15 10:25 
AnswerRe: what is the best tools can I use it to write Java code for Android Applications Pin
Richard MacCutchan27-Aug-15 21:20
mveRichard MacCutchan27-Aug-15 21:20 
GeneralRe: what is the best tools can I use it to write Java code for Android Applications Pin
Member 1194108931-Aug-15 3:05
Member 1194108931-Aug-15 3:05 
GeneralRe: what is the best tools can I use it to write Java code for Android Applications Pin
Richard MacCutchan31-Aug-15 5:44
mveRichard MacCutchan31-Aug-15 5:44 
Questionj2me java compile Pin
Member 1193294324-Aug-15 18:59
Member 1193294324-Aug-15 18:59 
AnswerRe: j2me java compile Pin
Richard MacCutchan24-Aug-15 21:39
mveRichard MacCutchan24-Aug-15 21:39 
QuestionCode Help! Pin
Member 1072866723-Aug-15 15:07
Member 1072866723-Aug-15 15:07 
I have several issues that I cannot figure out. I need to figure out how to ensure that all data is saved in the database. I also need to figure out how to display an order summary and order list. Any pointers in the right directions are appreciated.
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class Flooring extends JFrame implements ActionListener{
        JRadioButton radioWood, radioCarpet, radioGroup;
        JLabel labelName, labelAddress, labelLength, labelWidth; 
        JTextField textName, textAddress, textLength, textWidth, textCalculateArea;
        JButton buttonCalculateArea, buttonCalculateCost, buttonSubmitOrder, buttonDisplaySummary, buttonDisplayList;
        JTextArea textAreaSummary;
        JTabbedPane tabbedPane;

public Flooring() {

        super("Flooring");

        tabbedPane = new JTabbedPane();

        //Create Customer Panel & Add To JTabbedPane
        JPanel panel1 = new JPanel(new GridLayout(5, 2, 4, 9));

        labelName = new JLabel("Name: ", SwingConstants.CENTER);
        panel1.add(labelName);
        textName = new JTextField(10);
        panel1.add(textName);

        labelAddress = new JLabel("Address: ", SwingConstants.CENTER);
        panel1.add(labelAddress);
        textAddress = new JTextField(50);
        panel1.add(textAddress);

        tabbedPane.addTab("Customer", null, panel1, "First Panel");

        //Create Size Panel & Add To JTabbedPane
        JPanel panel2 = new JPanel(new GridLayout(5, 2, 4, 9));

        radioWood = new JRadioButton("Wood");
        radioWood.setBounds(336, 157, 64, 23);
        radioWood.setSelected(false);
        panel2.add(radioWood);

        radioCarpet = new JRadioButton("Carpet");
        radioCarpet.setBounds(336, 157, 64, 23);
        radioCarpet.setSelected(false);
        panel2.add(radioCarpet);

        labelLength = new JLabel("Flooring Length: ", SwingConstants.CENTER);
        panel2.add(labelLength);
        textLength = new JTextField(10);
        panel2.add(textLength);

        labelWidth = new JLabel("Flooring Width: ", SwingConstants.CENTER);
        panel2.add(labelWidth);
        textWidth = new JTextField(10);
        panel2.add(textWidth);

        buttonCalculateArea = new JButton("Calculate Area");
        panel2.add(buttonCalculateArea);
        buttonCalculateArea.addActionListener(this);

        textCalculateArea = new JTextField();
        panel2.add(textCalculateArea);

        buttonSubmitOrder = new JButton("Submit Order");
        panel2.add(buttonSubmitOrder);
        buttonSubmitOrder.addActionListener(this);

        tabbedPane.addTab("Size", null, panel2, "Second Panel");

        //Create Order Summary Panel & Add To JTabbedPane
        JPanel panel3 = new JPanel(new GridLayout(5, 2, 4, 9));

        buttonDisplaySummary = new JButton("Display Summary");
        panel3.add(buttonDisplaySummary);
        buttonDisplaySummary.addActionListener(this);

        tabbedPane.addTab("Summary", null, panel3, "Third Panel");

        //Create Order List & Add To JTabbedPane
        JPanel panel4 = new JPanel(new GridLayout(5, 2, 4, 9));
        buttonDisplayList = new JButton("Display List");
        panel4.add(buttonDisplayList);
        buttonDisplayList.addActionListener(this);

        tabbedPane.addTab("List", null, panel4, "Third Panel");

        //Group Radio Buttons
        ButtonGroup radioGroup = new ButtonGroup();
        radioGroup.add(radioWood);
        radioGroup.add(radioCarpet);

        //Register Radio Button Action Listeners
        radioWood.addActionListener(this);
        radioCarpet.addActionListener(this);

        //Add JTabbedPane To Frame
        getContentPane().add(tabbedPane);
        setSize(270,200);
        setVisible(true);
}

public void actionPerformed(ActionEvent e) {
    if (textName.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Must enter name!");
    }else
        textName.setText(textName.getText());

    if (textAddress.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Must enter address!");
    }else
        textAddress.setText(textAddress.getText());

    if (radioWood.isSelected()){
        radioWood.setText(radioWood.getText());
    }else if (radioCarpet.isSelected()){
        radioCarpet.setText(radioCarpet.getText());
    }else
        JOptionPane.showMessageDialog(null, "Must choose flooring type!");

    if (textLength.getText().equals("")){
        JOptionPane.showMessageDialog(null, "Must enter length!");
    }else
        textLength.setText(textLength.getText());

    if (textWidth.getText().equals("")){
            JOptionPane.showMessageDialog(null, "Must enter width!");
    }else
            textWidth.setText(textWidth.getText());

    if (e.getSource() == buttonCalculateArea){
        int length, width, area;
        length = Integer.parseInt(textLength.getText());
        width = Integer.parseInt(textWidth.getText());
        area = length * width;
        textCalculateArea.setText(Integer.toString(area));

    if (e.getSource() == buttonSubmitOrder){
        tabbedPane.setSelectedIndex(2);

    if (e.getSource() == buttonDisplaySummary){
        int flooringPrice = 0;
        int cost;

        if (radioWood.isSelected())
            flooringPrice = 20;
        if (radioCarpet.isSelected())
            flooringPrice = 10;

        cost = flooringPrice * area;

    if (e.getSource() == buttonDisplayList){

    }
    }
    }
}
}
}

import javax.swing.JFrame;

public class FlooringTest {
    public static void main( String args[] ){
        Flooring flooring = new Flooring();
        flooring.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
    }
} 

SuggestionRe: Code Help! Pin
Richard MacCutchan23-Aug-15 21:02
mveRichard MacCutchan23-Aug-15 21:02 
QuestionServlet Error Pin
goddynk19-Aug-15 4:36
goddynk19-Aug-15 4:36 
QuestionRe: Servlet Error Pin
Richard MacCutchan19-Aug-15 6:09
mveRichard MacCutchan19-Aug-15 6:09 
AnswerRe: Servlet Error Pin
jschell21-Aug-15 12:22
jschell21-Aug-15 12:22 
AnswerRe: Servlet Error Pin
Member 1193933126-Aug-15 21:34
Member 1193933126-Aug-15 21:34 
QuestionHow to Create Outlook Appointment in outlook from Java Application Pin
Member 1164569416-Aug-15 21:24
Member 1164569416-Aug-15 21:24 
AnswerRe: How to Create Outlook Appointment in outlook from Java Application Pin
Kannu Verma19-Aug-22 9:57
Kannu Verma19-Aug-22 9:57 
Questionadding signature box Pin
Aditya kumar16-Aug-15 19:23
Aditya kumar16-Aug-15 19:23 
AnswerRe: adding signature box Pin
Richard MacCutchan16-Aug-15 21:02
mveRichard MacCutchan16-Aug-15 21:02 
QuestionEnterprise application architecture Pin
Neo1010114-Aug-15 11:15
Neo1010114-Aug-15 11:15 
AnswerRe: Enterprise application architecture Pin
Richard MacCutchan14-Aug-15 20:51
mveRichard MacCutchan14-Aug-15 20:51 
GeneralRe: Enterprise application architecture Pin
Neo1010115-Aug-15 2:46
Neo1010115-Aug-15 2:46 
Questionhow to build 3d box Pin
Member 1189993511-Aug-15 5:56
Member 1189993511-Aug-15 5:56 
AnswerRe: how to build 3d box Pin
Richard MacCutchan11-Aug-15 6:20
mveRichard MacCutchan11-Aug-15 6:20 
GeneralRe: how to build 3d box Pin
Neo1010115-Aug-15 2:46
Neo1010115-Aug-15 2:46 
QuestionJava - Calculation in NEW array Pin
Frankie124511-Aug-15 5:36
Frankie124511-Aug-15 5:36 
AnswerRe: Java - Calculation in NEW array Pin
Richard MacCutchan11-Aug-15 6:15
mveRichard MacCutchan11-Aug-15 6:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.