mau ni amung codes mga bro pde pa help unsaon pra ang output kay ang synonyms sa g search na word.. g.exteralize ni nmu.
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ThesActions implements ActionListener{
private Thesaurus t;
public ThesActions(Thesaurus thes){
this.t= thes;
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String[][] A= new String[1][];
//search button
int a = 0;
if(e.getSource()==t.searchb){
//t.text.getText();
t.area.setText("");
for(int l=0; l<5; l++){
if(t.text.getText().equals(Messages.getString("A"+ a+"_"+l))){ //$NON-NLS-1$ //$NON-NLS-2$
for(int m=0;m<2;m++){
A[0]= new String[9];
}
for(int x=0; x<2; x++){
for(int y=0;y<10;y++){
A[0][x]=(Messages.getString("A"+a+"_"+y)); //$NON-NLS-1$ //$NON-NLS-2$
}
}
for(int x=0; x<1; x++){
for(int y=0;y<10;y++){
t.area.setText(t.area.getText() + Messages.getString("A"+a+"_"+y)); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}else{
a++;
}
}
}
}
}
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
public class Thesaurus {
JFrame frame;
JTextField text;
JButton searchb, addb, delb;
JTextArea area;
JComboBox sort;
ThesActions actions;
public Thesaurus(){
//JFrame.setDefaultLookAndFeelDecorated(true);
this.frame = new JFrame("Thesaurus"); //$NON-NLS-1$
this.text = new JTextField();
this.area = new JTextArea();
this.searchb = new JButton("Search"); //$NON-NLS-1$
this.delb = new JButton("Delete"); //$NON-NLS-1$
this.addb = new JButton("Add"); //$NON-NLS-1$
String[] SortOptions = { "Ascending", "Descending" }; //$NON-NLS-1$ //$NON-NLS-2$
this.sort = new JComboBox(SortOptions);
actions = new ThesActions(this);
}
public void launchGUI(){
this.frame.setSize(500,525);
// this.frame.setResizable(false);
this.frame.setLayout(new BorderLayout());
this.frame.setVisible(true);
/* added line */
this.frame.setDefaultCloseOperation(JFrame.EXIT_ON _CLOSE);
JPanel p = new JPanel();
p.setLayout(new FlowLayout());
this.text.setColumns(26);
p.add(this.text);
p.add(this.searchb);
searchb.addActionListener(this.actions);
JPanel p1 = new JPanel();
p1.setLayout(new FlowLayout());
p1.add(this.addb);
p1.add(this.delb);
p1.add(this.sort);
addb.addActionListener(this.actions);
delb.addActionListener(this.actions);
sort.addActionListener(this.actions);
JPanel pa = new JPanel();
this.area.setColumns(40);
this.area.setRows(25);
this.area.insert("\n\n\n\n\n\n\n\n\n\n\t\tTHESAURU S", 0); //$NON-NLS-1$
this.area.setEditable(false);
this.area.setLineWrap(true);
pa.add(this.area);
this.frame.add(p, BorderLayout.NORTH);
this.frame.add(pa, BorderLayout.CENTER);
this.frame.add(p1, BorderLayout.SOUTH);
}
}
(from message.properties)
A0_0=affliction
A0_1=abyss
A0_2=agony
A0_3=anguish
A0_4=blazes
A0_5=bottomless
A0_6=difficult
A0_7=hell
A0_8=perdition
A0_9=purgatory
A1_0=accept
A1_1=acknowledge
A1_2=abear
A1_3=concede
A1_4=consent
A1_5=defer
A1_6=endure
A1_7=hang in
A1_8=live with
A1_9=put up with