Results 1 to 9 of 9
- 09-19-2012, 05:18 PM #1
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
how to make java applet scrollable??
i am drawing some component like rectangles on the applet window.....if i draw the component below the visible screen then applet window doesn't show that components.....how can i scroll the applet so that i can see below the visible screen by scrolling....??
i am using NETBEANS IDE for developing Applets.
Plz help me...Last edited by kumar.dinesh7; 09-19-2012 at 05:20 PM.
dk
- 09-19-2012, 05:56 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Re: how to make java applet scrollable??
- 09-19-2012, 07:05 PM #3
Re: how to make java applet scrollable??
I've given you the link to the Oracle Swing tutorials at least twice before. If you were genuinely interested in learning, you would have had more than enough time to go through the entire tutorial trail and wouldn't still be asking silly questions.
I'll add that the NetBeans visual designer is categorically NOT a beginners' tool. Learn to hand-code GUIs first.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-20-2012, 09:44 AM #4
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: how to make java applet scrollable??
okay
dk
- 09-20-2012, 05:17 PM #5
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: how to make java applet scrollable??
Java Code:import java.applet.*; import java.awt.*; import javax.swing.*; class applet_opr extends Applet { public void init() { setBackground(Color.red); } public void paint(Graphics g) { g.drawRect(100, 100, 1200, 900); } } public class practical { public static void main(String[]args) { applet_opr pa=new applet_opr(); pa.init(); JScrollPane scrollBar=new JScrollPane(pa,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JFrame frame=new JFrame("AddScrollBarToJFrame"); frame.setLayout(new BorderLayout()); frame.add(scrollBar); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1000,700); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setVisible(true); } }
i tried this code....this code makes a scroll bar but scroll bar not working.Last edited by kumar.dinesh7; 09-20-2012 at 05:20 PM.
dk
- 09-20-2012, 06:56 PM #6
Re: how to make java applet scrollable??
Find the tutorial on developing and deploying Applets and go through the section that deals with the Applet life cycle.
Also, don't unnecessarily mix AWT and Swing components. Why do you think you need to use an Applet for this code?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-20-2012, 06:57 PM #7
Re: how to make java applet scrollable??
Additionally, I repeat my recommendation to go through the Swing tutorial systematically. Nothing in that code suggests that the scroll pane's content is larger than the viewport, so why should the scroll bars be active?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-21-2012, 08:22 AM #8
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: how to make java applet scrollable??
okay....can you provide me a better link where i can learn all this?
dk
- 09-21-2012, 10:49 AM #9
Similar Threads
-
Make applet run outside editor
By Maarten in forum New To JavaReplies: 4Last Post: 07-29-2012, 05:04 PM -
scrollable graph on JFrame. (I've made the graph and I need it scrollable)
By noobplus in forum AWT / SwingReplies: 16Last Post: 03-21-2012, 09:41 AM -
How do I make a JPanel (which holds images) scrollable?
By Ami in forum AWT / SwingReplies: 1Last Post: 03-03-2012, 09:35 PM -
scrollable applets
By kaemonsaionji in forum New To JavaReplies: 2Last Post: 02-25-2009, 08:47 AM -
Make java applet a button
By hervey in forum New To JavaReplies: 31Last Post: 10-30-2008, 05:44 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks