menu with scrollbar
I want to use MenuBar with Scrollbar. I tried it. I dont know how to do it. so please help me. The program should be....
1.add JScrollPane into the panel.
2.Panel layout should be null.
3.Use menubar
4.Each and every component should inside the panel.
I tried it but menu bar is not working in this program. Here is the code......
import javax.swing.*;
import java.awt.*;
public class menu extends JFrame
{
MenuBar bar;
Menu file,setting,rate,help,crate,prate;
public menu()
{
JFrame frame =new JFrame("Stock Analysis");
bar=new MenuBar();
file=new Menu("File");
setting=new Menu("Setting");
rate=new Menu("Rate");
help=new Menu("Help");
setMenuBar(bar);
bar.add(file);
bar.add(rate);
bar.add(setting);
bar.add(help);
JPanel panel=new JPanel();
JButton b1=new JButton("Button1");
JButton b2=new JButton("Button2");
panel.setLayout(null);
panel.setPreferredSize(new Dimension(1000, 1500));
b1.setBounds(100,100,150,50);
b2.setBounds(100,200,150,50);
panel.add(b1);
panel.add(b2);
JScrollPane s = new JScrollPane(panel);
frame.add(s);
frame.setVisible(true);
frame.setSize(500,500);
}
public static void main(String arg[])
{
menu m=new menu();
}
}
View Answers
October 19, 2010 at 3:21 PM
Hi Friend,
Try the following code:
import java.awt.*;
import javax.swing.*;
public class menu extends JFrame{
private JPanel panel;
public menu()
{
JMenuBar bar = new JMenuBar();
JMenu m = new JMenu("Info");
JMenuItem file = new JMenuItem("File");
JMenuItem setting = new JMenuItem("Setting");
JMenuItem rate = new JMenuItem("Rate");
JMenuItem help = new JMenuItem("Help");
m.add(file);
m.add(setting);
m.add(rate);
m.add(help);
bar.add(m);
this.setJMenuBar(bar);
panel = new JPanel();
JButton b1=new JButton("Button1");
JButton b2=new JButton("Button2");
panel.setLayout(null);
panel.setPreferredSize(new Dimension(1000, 1500));
b1.setBounds(100,100,150,50);
b2.setBounds(100,200,150,50);
panel.add(b1);
panel.add(b2);
JScrollPane s = new JScrollPane(panel);
this.add(s);
this.setSize(500,500);
this.setVisible(true);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
public static void main(String[]args){
menu me=new menu();
}
}
Thanks
Related Tutorials/Questions & Answers:
menu with scrollbarmenu with scrollbar I want to use MenuBar with
Scrollbar. I tried... and every component should inside the panel.
I tried it but
menu bar... java.awt.*;
public class
menu extends JFrame
{
MenuBar bar;
Menu file,setting,rate,help
scrollbarscrollbar I add a
scrollbar to my Frame and its not working
Advertisements
Java Scrollbar Java
Scrollbar What is the difference between a
Scrollbar and a ScrollPane
Scrollbar
Scrollbar
A
scrollbar is represented by a "slider" widget. The characteristics of it are specified by integer values which are being set at the time of
scrollbar Horizontal ScrollbarHorizontal Scrollbar I am creating a JSF project that has a print("<af:table/>"); the table is too wide to display in the browser. I was wondering if there was anyway to implement a horizontal
scrollbar in this table so
scrollbar in JPanelscrollbar in JPanel Scroll bar is not working when i am using the panel layout is null. If i change the panel layout to flow or grid its working. I..., JScrollPane.VERTICAL_
SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_
SCROLLBAR_ALWAYS);f.add(s
menumenu Hi,i want write the
menu that repeat several time
menumenu fibonaci & prime no. display in
menu driven in java programme
java program:scrollbarjava program:scrollbar my program logic is that when i scrolling
scrollbar according to that the oval shap is changed by fetching the value of
scrollbar the oval is drawn please give me a proper code of this logic
MenuMenu Pl make a program which generates the following output.
"Select from this
menu"
1. Array
2. Stack
3. Queue.
4. Exit.
If users press 1, then it will go in 1. Array.
(adsbygoogle = window.adsbygoogle || []).push
CSS ScrollBar PropertiesCSS
ScrollBar Properties How can i set
ScrollBar properties in CSS?
I am using HTML, CSS and Div in my code.
Thanks!!
overflow: scroll;
overflow-y: scroll;
overflow-x: scroll;
overflow:-moz-scrollbars-vertical
scrollbar - applet - Appletscrollbar - applet Hi!!
It is the program for a vertical scroll bar and the output is (small vertical
scrollbar).
Suppose if I want a lengthy... ScrollbarDemo extends Applet {
public void init() {
Scrollbar sb = new
dropdown to vert. scrollbar - Java Beginners a dropdown into
scrollbar when we resize th window in java script Hi... drop down
menu javascript will save you a lot of space. Great for sites that give volumes of information, the visitor chooses the topic from the drop down
menu div to scrollbar - Java Beginners vertical
scrollbar. for this i am using a css for that div in which i tried to add... who replied my answer. hi,
div and
scrollbar
html... "";
}
function
scrollBar(ownerID, ownerContentID, upID, dnID) {
this.ownerID
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java application in which i have a frame to which i wanted to add scrollbars but when... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java application in which i have a frame to which i wanted to add scrollbars but when... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java application in which i have a frame to which i wanted to add scrollbars but when... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java application in which i have a frame to which i wanted to add scrollbars but when... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help
how to add scrollbar to JFramehow to add
scrollbar to JFrame hello friends
i am making a java application in which i have a frame to which i wanted to add scrollbars but when... it shows the
scrollbar but do not show the scrolling tabs here is my code pls do help
How set the height of Thumb in Vertical scrollbar..?How set the height of Thumb in Vertical
scrollbar..? I have created a Vertical
scrollbar.
I have removed up arrow and down arrow. also i have changed the skin of thumb by including
an image to it. I want the size of thumb same
Flex scrollbar controlFlex
ScrollBar Control:-
If the user handles data that are displayed but data is too much and not fit
in the display area then the user use
ScrollBar... the button depends on the current state of the
ScrollBar controls. If user
Example
menu driven menu driven
menu driven programm in
decimal to binary
binary to decimal
menu drivenmenu driven display the 1-30 prime no. and fibonacie series in
menu driven programme
Fix Scrollbar position in a checkboxList after postbackFix
Scrollbar position in a checkboxList after postback Hi,
I have a CheckBoxList in which have lot of items and i set AutoPostBack="True".I am using
Scrollbar on this list.Now when I am checking any item then after postback
menu problemmenu problem Hi to all ,
I am inserting a
menu in my jsp page.i have downloaded(free) a
menu .In which 4 files are as below.
1. index.html
2. menu.css
3. menu.js
4. jquery.js
I have edited
DropDown Menu menu that has the list of Page 1- Page 5.
if i select page 1 it will display only... is the problem..
for example;
if i select page 1 in my dropdown
menu, and click
menu driven programme menu driven programme calculate the area of circle, square, rectangle in
menu driven programme in java
ModuleNotFoundError: No module named 'Menu'ModuleNotFoundError: No module named '
Menu' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
Menu'
How to remove the ModuleNotFoundError: No module named '
Menu' error
Menu Bar prob.Menu Bar prob. I want a
menu to be displayed in each page of my swing appl. how to go abt
highlight menu item htmlhighlight
menu item html highlight
menu item in html or CSS
<body id="index">
<div id="
menu">
<ul>
<li class...;
</ul>
</div> <!--
menu -->
</body>
creating pop up menu creating pop up
menu how to create a pop up
menu when a link in html page is clicked using jquery? and the link should be a text file
Please visit the following links:
http://www.roseindia.net/tutorial/jquery
context menu overlapped in IE8context
menu overlapped in IE8 I developed a contex
menu in XHTML while opening it is overlapped in border of IE8 browser.
even i have tried change the zaxis in css.
I am using like below