Ram Sita

Greenhorn
+ Follow
since Jul 14, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ram Sita

I have incorporated a TextArea in the panel of my JFrame that also has a Canvas and numerous button. When I attempt to access the JMenuItems from the menu bar, the options are hidden under the TextArea. I've tried adding the JMenuBar as the last segment of code, but that seems to have no affect. If you run the code below and try to access the File menu, you'll see what I mean. SOMEONE PLEASE HELP!!
import java.awt.event.*;
import java.io.*;
import java.awt.Window;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import java.lang.*;

public class getHelp
{
JLabel statusBar;
JMenuItem Open;
JMenuItem Close;
JMenuItem Save;
JMenuItem SaveAs;
JMenuItem Print;
JMenuItem Exit;
JMenuItem Undo;
JMenuItem Mode;
JMenuItem Index;
JMenuItem About;
JMenuItem ClearText;
JMenuItem ClearScreen;
JMenuItem Execute;
JButton Exec;
JButton ClrTxt;
JButton ClrScrn;
JButton Toggle;
JButton Load;
JButton Prnt;
int toggleCounter = 0;
TextArea textPane;
JPanel panel;
JPanel p;
JPanel p4;
TextField instructionField;
JLabel instFieldLabel;
//parser instructionParser = new parser();

public static void main(String[] args)
{
getHelpuserInterface = new getHelp();
userInterface.init();
}
private void init()
{
JFrame frame = new JFrame("HelpMe");

frame.addWindowListener(new BasicWindowMonitor());
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
//JMenu editMenu = new JMenu("Edit");
JMenu toolsMenu = new JMenu("Tools");
JMenu helpMenu = new JMenu("Help");
Open = new JMenuItem("Open");
Close = new JMenuItem("Close");
//Save = new JMenuItem("Save");
SaveAs = new JMenuItem("Save As...");
Print = new JMenuItem("Print");
Exit = new JMenuItem("Exit");
//Undo = new JMenuItem("Undo");
Mode = new JMenuItem("Switch Mode");
ClearText = new JMenuItem("Clear Text");
ClearScreen = new JMenuItem("Clear Screen");
Execute = new JMenuItem("Execute");
Index = new JMenuItem("Index");
About = new JMenuItem("About TurtleWorld2001");

fileMenu.add(Open);
fileMenu.add(Close);
//fileMenu.add(Save);
fileMenu.add(SaveAs);
fileMenu.add(Print);
fileMenu.add(Exit);
//editMenu.add(Undo);
toolsMenu.add(Mode);
toolsMenu.add(ClearText);
toolsMenu.add(ClearScreen);
toolsMenu.add(Execute);
helpMenu.add(Index);
helpMenu.add(About);
//Container contentPane = frame.getContentPane();
//contentPane.setSize(850,500);
//contentPane.setLayout(new GridLayout(1,3));
//contentPane.add("Center", new JButton("Main application area"));
//JPanel content = (JPanel)frame.getContentPane();
panel = new JPanel();
//panel.setLayout(new GridLayout(1,3));

panel.setLayout(new BorderLayout());
//content.setLayout(new GridLayout(2,1));
p = new JPanel();
p.setSize(50,50);
p.add(new JLabel("Command Screen"));
//p.add();
textPane = new TextArea("", 1000, 30, TextArea.SCROLLBARS_VERTICAL_ONLY);
//textPane.setSize(50,100);
instFieldLabel = new JLabel("Enter Instruction: ", Label.RIGHT);
instructionField = new TextField(30);
p4 = new JPanel();
p4.add(instFieldLabel);
p4.add(instructionField);
panel.add(p4, BorderLayout.SOUTH);
// p4.setVisible(true);

//panel.add(instFieldLabel, BorderLayout.SOUTH);
//panel.add(instructionField, BorderLayout.SOUTH);
panel.add(textPane, BorderLayout.WEST);
//panel.add(p);
//**********CHANGE TO panel.add(textPane)*************************//
//JPanel content2 = (JPanel)frame.getContentPane();
//content.setLayout(new GridLayout(2,1));
JPanel p2 = new JPanel();
p2.setSize(500,250);
//panel.add(p2, BorderLayout.CENTER);
Canvas floor = new Canvas();
floor.setBackground(Color.black);
floor.setSize(500, 450);
p2.add(floor);
panel.add(p2, BorderLayout.CENTER);

JPanel p3 = new JPanel();
//p3.setSize(250,250);
p3.setLayout(new GridLayout(6, 1, 5, 5));
Exec = new JButton("Execute");
ClrTxt = new JButton("Clear Text");
ClrScrn = new JButton("Clear Screen");
Toggle = new JButton("Toggle Mode");
Load = new JButton("Load file...");
Prnt = new JButton("Print");
Exec.setVisible(true);
ClrTxt.setVisible(true);
ClrScrn.setVisible(true);
Toggle.setVisible(true);
Load.setVisible(true);
Prnt.setVisible(true);
p3.add(Exec);
p3.add(ClrTxt);
p3.add(ClrScrn);
p3.add(Toggle);
p3.add(Load);
p3.add(Prnt);
panel.add(p3, BorderLayout.EAST);
p.setBorder(new LineBorder(Color.red));
p2.setBorder(new LineBorder(Color.black));
p3.setBorder(new LineBorder(Color.blue));

frame.setContentPane(panel);
menuBar.add(fileMenu);
menuBar.add(toolsMenu);
menuBar.add(helpMenu);
frame.setJMenuBar(menuBar);
menuBar.setVisible(true);
//statusBar = new JLabel(" ");
//statusBar.setVisible(true);
frame.setSize(900,550);
frame.setVisible(true);
instFieldLabel.setVisible(false);
instructionField.setVisible(false);
}
}
class BasicWindowMonitor extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
Window w = e.getWindow();
w.setVisible(false);
w.dispose();
System.exit(0);
}
}
22 years ago
I have incorporated a TextArea in the panel of my JFrame that also has a Canvas and numerous button. When I attempt to access the JMenuItems from the menu bar, the options are hidden under the TextArea. I've tried adding the JMenuBar as the last segment of code, but that seems to have no affect. If you run the code below and try to access the File menu, you'll see what I mean. SOMEONE PLEASE HELP!!
import java.awt.event.*;
import java.io.*;
import java.awt.Window;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import java.lang.*;

public class getHelp
{
JLabel statusBar;
JMenuItem Open;
JMenuItem Close;
JMenuItem Save;
JMenuItem SaveAs;
JMenuItem Print;
JMenuItem Exit;
JMenuItem Undo;
JMenuItem Mode;
JMenuItem Index;
JMenuItem About;
JMenuItem ClearText;
JMenuItem ClearScreen;
JMenuItem Execute;
JButton Exec;
JButton ClrTxt;
JButton ClrScrn;
JButton Toggle;
JButton Load;
JButton Prnt;
int toggleCounter = 0;
TextArea textPane;
JPanel panel;
JPanel p;
JPanel p4;
TextField instructionField;
JLabel instFieldLabel;
//parser instructionParser = new parser();

public static void main(String[] args)
{
getHelpuserInterface = new getHelp();
userInterface.init();
}
private void init()
{
JFrame frame = new JFrame("HelpMe");

frame.addWindowListener(new BasicWindowMonitor());
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
//JMenu editMenu = new JMenu("Edit");
JMenu toolsMenu = new JMenu("Tools");
JMenu helpMenu = new JMenu("Help");
Open = new JMenuItem("Open");
Close = new JMenuItem("Close");
//Save = new JMenuItem("Save");
SaveAs = new JMenuItem("Save As...");
Print = new JMenuItem("Print");
Exit = new JMenuItem("Exit");
//Undo = new JMenuItem("Undo");
Mode = new JMenuItem("Switch Mode");
ClearText = new JMenuItem("Clear Text");
ClearScreen = new JMenuItem("Clear Screen");
Execute = new JMenuItem("Execute");
Index = new JMenuItem("Index");
About = new JMenuItem("About TurtleWorld2001");

fileMenu.add(Open);
fileMenu.add(Close);
//fileMenu.add(Save);
fileMenu.add(SaveAs);
fileMenu.add(Print);
fileMenu.add(Exit);
//editMenu.add(Undo);
toolsMenu.add(Mode);
toolsMenu.add(ClearText);
toolsMenu.add(ClearScreen);
toolsMenu.add(Execute);
helpMenu.add(Index);
helpMenu.add(About);
//Container contentPane = frame.getContentPane();
//contentPane.setSize(850,500);
//contentPane.setLayout(new GridLayout(1,3));
//contentPane.add("Center", new JButton("Main application area"));
//JPanel content = (JPanel)frame.getContentPane();
panel = new JPanel();
//panel.setLayout(new GridLayout(1,3));

panel.setLayout(new BorderLayout());
//content.setLayout(new GridLayout(2,1));
p = new JPanel();
p.setSize(50,50);
p.add(new JLabel("Command Screen"));
//p.add();
textPane = new TextArea("", 1000, 30, TextArea.SCROLLBARS_VERTICAL_ONLY);
//textPane.setSize(50,100);
instFieldLabel = new JLabel("Enter Instruction: ", Label.RIGHT);
instructionField = new TextField(30);
p4 = new JPanel();
p4.add(instFieldLabel);
p4.add(instructionField);
panel.add(p4, BorderLayout.SOUTH);
// p4.setVisible(true);

//panel.add(instFieldLabel, BorderLayout.SOUTH);
//panel.add(instructionField, BorderLayout.SOUTH);
panel.add(textPane, BorderLayout.WEST);
//panel.add(p);
//**********CHANGE TO panel.add(textPane)*************************//
//JPanel content2 = (JPanel)frame.getContentPane();
//content.setLayout(new GridLayout(2,1));
JPanel p2 = new JPanel();
p2.setSize(500,250);
//panel.add(p2, BorderLayout.CENTER);
Canvas floor = new Canvas();
floor.setBackground(Color.black);
floor.setSize(500, 450);
p2.add(floor);
panel.add(p2, BorderLayout.CENTER);

JPanel p3 = new JPanel();
//p3.setSize(250,250);
p3.setLayout(new GridLayout(6, 1, 5, 5));
Exec = new JButton("Execute");
ClrTxt = new JButton("Clear Text");
ClrScrn = new JButton("Clear Screen");
Toggle = new JButton("Toggle Mode");
Load = new JButton("Load file...");
Prnt = new JButton("Print");
Exec.setVisible(true);
ClrTxt.setVisible(true);
ClrScrn.setVisible(true);
Toggle.setVisible(true);
Load.setVisible(true);
Prnt.setVisible(true);
p3.add(Exec);
p3.add(ClrTxt);
p3.add(ClrScrn);
p3.add(Toggle);
p3.add(Load);
p3.add(Prnt);
panel.add(p3, BorderLayout.EAST);
p.setBorder(new LineBorder(Color.red));
p2.setBorder(new LineBorder(Color.black));
p3.setBorder(new LineBorder(Color.blue));

frame.setContentPane(panel);
menuBar.add(fileMenu);
menuBar.add(toolsMenu);
menuBar.add(helpMenu);
frame.setJMenuBar(menuBar);
menuBar.setVisible(true);
//statusBar = new JLabel(" ");
//statusBar.setVisible(true);
frame.setSize(900,550);
frame.setVisible(true);
instFieldLabel.setVisible(false);
instructionField.setVisible(false);
}
}
class BasicWindowMonitor extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
Window w = e.getWindow();
w.setVisible(false);
w.dispose();
System.exit(0);
}
}
22 years ago
I have incorporated a TextArea in the panel of my JFrame that also has a Canvas and numerous button. When I attempt to access the JMenuItems from the menu bar, the options are hidden under the TextArea. I've tried adding the JMenuBar as the last segment of code, but that seems to have no affect. If you run the code below and try to access the File menu, you'll see what I mean. SOMEONE PLEASE HELP!!
import java.awt.event.*;
import java.io.*;
import java.awt.Window;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import java.lang.*;

public class getHelp
{
JLabel statusBar;
JMenuItem Open;
JMenuItem Close;
JMenuItem Save;
JMenuItem SaveAs;
JMenuItem Print;
JMenuItem Exit;
JMenuItem Undo;
JMenuItem Mode;
JMenuItem Index;
JMenuItem About;
JMenuItem ClearText;
JMenuItem ClearScreen;
JMenuItem Execute;
JButton Exec;
JButton ClrTxt;
JButton ClrScrn;
JButton Toggle;
JButton Load;
JButton Prnt;
int toggleCounter = 0;
TextArea textPane;
JPanel panel;
JPanel p;
JPanel p4;
TextField instructionField;
JLabel instFieldLabel;
//parser instructionParser = new parser();

public static void main(String[] args)
{
getHelpuserInterface = new getHelp();
userInterface.init();
}
private void init()
{
JFrame frame = new JFrame("HelpMe");

frame.addWindowListener(new BasicWindowMonitor());
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
//JMenu editMenu = new JMenu("Edit");
JMenu toolsMenu = new JMenu("Tools");
JMenu helpMenu = new JMenu("Help");
Open = new JMenuItem("Open");
Close = new JMenuItem("Close");
//Save = new JMenuItem("Save");
SaveAs = new JMenuItem("Save As...");
Print = new JMenuItem("Print");
Exit = new JMenuItem("Exit");
//Undo = new JMenuItem("Undo");
Mode = new JMenuItem("Switch Mode");
ClearText = new JMenuItem("Clear Text");
ClearScreen = new JMenuItem("Clear Screen");
Execute = new JMenuItem("Execute");
Index = new JMenuItem("Index");
About = new JMenuItem("About TurtleWorld2001");

fileMenu.add(Open);
fileMenu.add(Close);
//fileMenu.add(Save);
fileMenu.add(SaveAs);
fileMenu.add(Print);
fileMenu.add(Exit);
//editMenu.add(Undo);
toolsMenu.add(Mode);
toolsMenu.add(ClearText);
toolsMenu.add(ClearScreen);
toolsMenu.add(Execute);
helpMenu.add(Index);
helpMenu.add(About);
//Container contentPane = frame.getContentPane();
//contentPane.setSize(850,500);
//contentPane.setLayout(new GridLayout(1,3));
//contentPane.add("Center", new JButton("Main application area"));
//JPanel content = (JPanel)frame.getContentPane();
panel = new JPanel();
//panel.setLayout(new GridLayout(1,3));

panel.setLayout(new BorderLayout());
//content.setLayout(new GridLayout(2,1));
p = new JPanel();
p.setSize(50,50);
p.add(new JLabel("Command Screen"));
//p.add();
textPane = new TextArea("", 1000, 30, TextArea.SCROLLBARS_VERTICAL_ONLY);
//textPane.setSize(50,100);
instFieldLabel = new JLabel("Enter Instruction: ", Label.RIGHT);
instructionField = new TextField(30);
p4 = new JPanel();
p4.add(instFieldLabel);
p4.add(instructionField);
panel.add(p4, BorderLayout.SOUTH);
// p4.setVisible(true);

//panel.add(instFieldLabel, BorderLayout.SOUTH);
//panel.add(instructionField, BorderLayout.SOUTH);
panel.add(textPane, BorderLayout.WEST);
//panel.add(p);
//**********CHANGE TO panel.add(textPane)*************************//
//JPanel content2 = (JPanel)frame.getContentPane();
//content.setLayout(new GridLayout(2,1));
JPanel p2 = new JPanel();
p2.setSize(500,250);
//panel.add(p2, BorderLayout.CENTER);
Canvas floor = new Canvas();
floor.setBackground(Color.black);
floor.setSize(500, 450);
p2.add(floor);
panel.add(p2, BorderLayout.CENTER);

JPanel p3 = new JPanel();
//p3.setSize(250,250);
p3.setLayout(new GridLayout(6, 1, 5, 5));
Exec = new JButton("Execute");
ClrTxt = new JButton("Clear Text");
ClrScrn = new JButton("Clear Screen");
Toggle = new JButton("Toggle Mode");
Load = new JButton("Load file...");
Prnt = new JButton("Print");
Exec.setVisible(true);
ClrTxt.setVisible(true);
ClrScrn.setVisible(true);
Toggle.setVisible(true);
Load.setVisible(true);
Prnt.setVisible(true);
p3.add(Exec);
p3.add(ClrTxt);
p3.add(ClrScrn);
p3.add(Toggle);
p3.add(Load);
p3.add(Prnt);
panel.add(p3, BorderLayout.EAST);
p.setBorder(new LineBorder(Color.red));
p2.setBorder(new LineBorder(Color.black));
p3.setBorder(new LineBorder(Color.blue));

frame.setContentPane(panel);
menuBar.add(fileMenu);
menuBar.add(toolsMenu);
menuBar.add(helpMenu);
frame.setJMenuBar(menuBar);
menuBar.setVisible(true);
//statusBar = new JLabel(" ");
//statusBar.setVisible(true);
frame.setSize(900,550);
frame.setVisible(true);
instFieldLabel.setVisible(false);
instructionField.setVisible(false);
}
}
class BasicWindowMonitor extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
Window w = e.getWindow();
w.setVisible(false);
w.dispose();
System.exit(0);
}
}
22 years ago