Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 3rd, 2004, 12:33 PM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to starsailor
Default not exactly sure whee to go next

hi, im trying to write a quote generator which will take
in a author and a topic area and then returns a random quote
this is the code which i have done so far can anybody please put me in the right direction

import java.awt.*;
import java.util.*;
import java.applet.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.Graphics;
import java.awt.Color;



public class Assessement2 extends JApplet implements ActionListener{


    JLabel Title,Photo;
    JComboBox AuthorCombo,TopicCombo;
    JButton QuoteButton;
    JTextArea QuoteArea;//various variables that i needed to complete the program
    ArrayList Author= new ArrayList();





public void init(){//this method is used to organise the interface





        Container c =getContentPane();
        c.setLayout(null);


        Title=new JLabel("Quote Generator", JLabel.CENTER);
        Title.setFont(new Font("Serif", Font.BOLD, 24));
        Title.setForeground(Color.white);
        Title.setBounds(0,5,350,30);
        c.add(Title);

        //Photo=new JLabel(candle.gif);

        //private Image candle;

        AuthorCombo=new JComboBox();
        AuthorCombo.setBounds(10,50,150,25);
        AuthorCombo.setForeground(Color.white);
        AuthorCombo.addItem("Sanny McCsandwich");
        AuthorCombo.addItem("Scott Sinclair");
        c.add(AuthorCombo);

        TopicCombo=new JComboBox();
        TopicCombo.setBounds(190,50,150,25);
        TopicCombo.setForeground(Color.white);
        TopicCombo.addItem("Religious");
        TopicCombo.addItem("Humour");
        c.add(TopicCombo);

        QuoteArea=new JTextArea();
        QuoteArea.setBounds(10,85,260,170);
        c.add(QuoteArea);

        QuoteButton=new JButton("Press Here For Quote");
        QuoteButton.setBounds(2,270,348,30);
        QuoteButton.setForeground(Color.white);
        c.add(QuoteButton);
        QuoteButton.addActionListener(this);
}

public void actionPerformed (ActionEvent e){

        if(e.getSource() ==QuoteButton){//adds the data to the java consol

        SerachArray();
        }

}

public void SerachArray();
    {
      String StrAuthor=(String)AuthorCombo.getSelectedItem();
      String StrTopic=(String)TopicCombo.getSelectedItem();


    }


       /*boolean sentenceFound=false;
       ArrayList searchString = new ArrayList();
       searchString.add ("beefy");
       searchString.add ("bing");
       searchString.add ("frogs");
       searchString.add ("assassination");
       searchString.add ("blue");



        boolean WordStore[] = new boolean[5];
        WordStore[0] = false; //beefy
        WordStore[1] = false; //bing
        WordStore[2] = false; //frogs
        WordStore[3] = false; //assassination
           WordStore[4] = false; //blue

    }*/



        }
}

help would be much appreciated










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.