Scrollbar for a frame
hi all,
iam doing a project in swing . in it there are 6 tabs, is it possible to add a scrollbar for the tabs . i have tried this by adding the tabbed pane to the scrollpane but the scroll bars are not visible.
could u pls tell me how to add a scroll bar for the tabs.
have you tried:
JFrame f = new JFrame();
JTabbedPane t = new JTabbedPane();
/* add your tabs */
JScrollPane p = new JScrollPane(t);
f.getContentPane().add(p);thomas
Similar Messages
-
How do i use jbutton for mutiple frames(2frames)???
im an creating a movie database program and i have a problem with the jButtons on my second frame i dont know how to make them work when clicked on. i managed to make the jButtons work on my first frame but not on the second....
here is that code so far----
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
* real2.java
* Created on December 7, 2007, 9:00 AM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
* @author J
public class real2 extends JPanel implements ActionListener{
private JButton addnew;
private JButton help;
private JButton exit;
private JFrame frame1;
private JButton save;
private JButton cancel;
private JButton save2;
private JLabel moviename;
private JTextField moviename2;
private JLabel director;
private JTextField director2;
private JLabel year;
private JTextField year2;
private JLabel genre;
private JTextField genre2;
private JLabel plot;
private JTextField plot2;
private JLabel rating;
private JTextField rating2;
/** Creates a new instance of real2 */
public real2() {
super(new GridBagLayout());
//Create the Buttons.
addnew = new JButton("Add New");
addnew.addActionListener(this);
addnew.setMnemonic(KeyEvent.VK_E);
addnew.setActionCommand("Add New");
help = new JButton("Help");
help.addActionListener(this);
help.setActionCommand("Help");
exit = new JButton("Exit");
exit.addActionListener(this);
exit.setActionCommand("Exit");
String[] columnNames = {"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
Object[][] data = {
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)}
final JTable table = new JTable(data, columnNames);
table.setPreferredScrollableViewportSize(new Dimension(600, 100));
table.setFillsViewportHeight(true);
//Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);
//Add the scroll pane to this panel.
add(scrollPane);
GridBagConstraints c = new GridBagConstraints();
c.weightx = 1;
c.gridx = 0;
c.gridy = 1;
add(addnew, c);
c.gridx = 0;
c.gridy = 2;
add(help, c);
c.gridx = 0;
c.gridy = 3;
add(exit, c);
public static void addComponentsToPane(Container pane){
pane.setLayout(null);
//creating the components for the new frame
JButton save = new JButton("Save");
JButton save2 = new JButton("Save and add another");
JButton cancel = new JButton("Cancel");
JLabel moviename= new JLabel("Movie Name");
JTextField moviename2 = new JTextField(8);
JLabel director = new JLabel("Director");
JTextField director2 = new JTextField(8);
JLabel genre = new JLabel("Genre");
JTextField genre2 = new JTextField(8);
JLabel year = new JLabel("year");
JTextField year2 = new JTextField(8);
JLabel plot = new JLabel("Plot");
JTextField plot2 = new JTextField(8);
JLabel rating = new JLabel("Rating(of 10)");
JTextField rating2 = new JTextField(8);
//adding components to new frame
pane.add(save);
pane.add(save2);
pane.add(cancel);
pane.add(moviename);
pane.add(moviename2);
pane.add(director);
pane.add(director2);
pane.add(genre);
pane.add(genre2);
pane.add(year);
pane.add(year2);
pane.add(plot);
pane.add(plot2);
pane.add(rating);
pane.add(rating2);
//setting positions of components for new frame
Insets insets = pane.getInsets();
Dimension size = save.getPreferredSize();
save.setBounds(100 , 50 ,
size.width, size.height);
size = save2.getPreferredSize();
save2.setBounds(200 , 50 ,
size.width, size.height);
size = cancel.getPreferredSize();
cancel.setBounds(400 , 50 ,
size.width, size.height);
size = moviename.getPreferredSize();
moviename.setBounds(100 , 100 ,
size.width, size.height);
size = moviename2.getPreferredSize();
moviename2.setBounds(200 , 100 ,
size.width, size.height);
size = director.getPreferredSize();
director.setBounds(100, 150 ,
size.width, size.height);
size = director2.getPreferredSize();
director2.setBounds(200 , 150 ,
size.width, size.height);
size = genre.getPreferredSize();
genre.setBounds(100 , 200 ,
size.width, size.height);
size = genre2.getPreferredSize();
genre2.setBounds(200 , 200 ,
size.width, size.height);
size = year.getPreferredSize();
year.setBounds(100 , 250 ,
size.width, size.height);
size = year2.getPreferredSize();
year2.setBounds(200 , 250 ,
size.width, size.height);
size = plot.getPreferredSize();
plot.setBounds(100 , 300 ,
size.width, size.height);
size = plot2.getPreferredSize();
plot2.setBounds(200 , 300 ,
size.width, size.height);
size = rating.getPreferredSize();
rating.setBounds(100 , 350 ,
size.width, size.height);
size = rating2.getPreferredSize();
rating2.setBounds(200 , 350 ,
size.width, size.height);
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.add(new real2());
//Display the window.
frame.setSize(600, 360);
frame.setVisible(true);
frame.pack();
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
public void actionPerformed(ActionEvent e) {
if ("Add New".equals(e.getActionCommand())){
frame1 = new JFrame("add");
frame1.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
addComponentsToPane(frame1.getContentPane());
frame1.setSize(600, 500);
frame1.setVisible(true);
//disableing first frame etc:-
if (frame1.isShowing()){
addnew.setEnabled(false);
help.setEnabled(false);
exit.setEnabled(true);
frame1.setVisible(true);
}else{
addnew.setEnabled(true);
help.setEnabled(true);
exit.setEnabled(true);
if ("Exit".equals(e.getActionCommand())){
System.exit(0);
if ("Save".equals(e.getActionCommand())){
// whatever i ask it to do it wont for example---
help.setEnabled(true);
if ("Save" == e.getSource()) {
//i tried this way too but it dint work here either
help.setEnabled(true);
}so if someone could help me by either telling me what to type or by replacing what iv done wrong that would be great thanks...(1)Java class name should begin with a capital letter. See: http://java.sun.com/docs/codeconv/
JButton save = new JButton("Save");
JButton save2 = new JButton("Save and add another");
// ... etc. ...(2)Don't redeclare class members in a method as its local variable. Your class members become eternally null, a hellish null.
how to make them work when clicked on(3)Add action listener to them. -
To use one SessionInfo for multiple frames
how to use one SessionInfo for master frame and other frame the detail
Thanks for your reply.You can instantiate the SessionInfo and other dataproducer objects in frame1 and bind them to controls in the first and second frames.
If you plan to change/execute queries pass the sessionInfo instance to the second frame.
Hope this helps.
Sathish
null -
Apex 5.0, Horizontal scrollbar for Interactive Report and Pivot Format
Hi,
i would like to know how to have an horizontal scrollbar for an interactive report (5.0) after making a pivot from the user interface; i have a lot of columns and without the pivot the horizontal scrollbar appears . After it doesn't appear.
I tried with the Region Header <div style="overflow:auto;"> and Region Footer </div> but without success.
Regards
GianpaoloHi gianpagi,
gianpagi wrote:
i would like to know how to have an horizontal scrollbar for an interactive report (5.0) after making a pivot from the user interface; i have a lot of columns and without the pivot the horizontal scrollbar appears . After it doesn't appear.
I tried with the Region Header <div style="overflow:auto;"> and Region Footer </div> but without success.
Please mention the theme and template you are using for the Interactive Report.
Can you re-produce the issue on apex.oracle.com and share the workspace credentials, so that can have closer look at the issue?
Regards,
Kiran -
Vertical Scrollbar for a slide
I'm new to captivate. Can anybody help me to get a vertical
scrollbar for the slides?Hi TrioRocks,
Thanks for your reply. It worked fine. i imported the flash
.swf file in my application but the only problem is that i cannot
edit the content of the slide after importing the flash file. -
Horizontal scrollbar for JComboBox - Not workable under Mac
By referring to this thread Re: Horizontal scrollbar for JComboBox across multiple look and feel I try to provide horizontal scroll bar for JComboBox to my clients.
private void adjustScrollBar() {
//if (this.getItemCount() == 0) return;
Object comp = this.getUI().getAccessibleChild(this, 0);
if (!(comp instanceof JPopupMenu)) {
return;
JPopupMenu popup = (JPopupMenu) comp;
// Works fine under Windows and Ubuntu Linux
// However, in OSX 10.6.4
// javax.swing.Box$Filler cannot be cast to javax.swing.JScrollPane
JScrollPane scrollPane = (JScrollPane) popup.getComponent(0);
scrollPane.setHorizontalScrollBar(new JScrollBar(JScrollBar.HORIZONTAL));
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}The above code will cause ClassException under OSX 10.6.4. (Works fine for Windows and Linux)
Any suggestion to resolve this problem. Sorry. I do not have a Mac machine. Hence, can't experiment out much with it.
ThanksThe following code works quite well for me.
private void adjustScrollBar() {
final int max_search = 8;
// i < max_search is just a safe guard when getAccessibleChildrenCount
// returns an arbitary large number. 8 is magic number
JPopupMenu popup = null;
for (int i = 0, count = this.getUI().getAccessibleChildrenCount(this); i < count && i < max_search; i++) {
Object o = this.getUI().getAccessibleChild(this, i);
if (o instanceof JPopupMenu) {
popup = (JPopupMenu)o;
break;
if (popup == null) {
return;
JScrollPane scrollPane = null;
for (int i = 0, count = popup.getComponentCount(); i < count && i < max_search; i++) {
Component c = popup.getComponent(i);
if (c instanceof JScrollPane) {
scrollPane = (JScrollPane)c;
break;
if (scrollPane == null) {
return;
scrollPane.setHorizontalScrollBar(new JScrollBar(JScrollBar.HORIZONTAL));
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
} -
Horizontal scrollbar for JComboBox
Hi,
I want to use Horizontal scrollbar for JComboBox which i have used as an editor for table column cell and the matter in drop down list is larger but the width of column of a table is relatively small
Any suggetions!
Thanks and regards,
NileshHi,
I want to use Horizontal scrollbar for JComboBox which i have used as an editor for table column cell and the matter in drop down list is larger but the width of column of a table is relatively small
Any suggetions!
Thanks and regards,
Nilesh -
How can i set each still image to show for 1 frame?
im trying to create a 60fps timelapse but i just can't get each image to show for less than 2 frames, i've gone to edit>preferences>import and set the still footage length to 0:00:00:01. and i've set the sequence footage to 60fps(although i'm not positive what this does)
i then bring my photos down to create new composition set it to 0:00:00:01 still duration and then each photo shows for 2 frames, any ideas?
thanks a lot!If you import a single frame as an image sequence it will be 2 frames long.
If you import an image sequence as an image sequence you won't be able to see the individual frames in the timeline as being 2 frames long. However, if your composition is set to 60 fps and the image sequence is interpreted as 30 fps, when you step through the footage there will be pairs of identical frames. Change the interpretation to 60 fps and the image sequence will be half as long but each frame will be unique. -
How to change FM8 default setting for Anchored Frame?
Hello,
I would like to change the default settings in FrameMaker 8 for Anchored Frame.
Currently, when I import an .ai file into FrameMaker 8, I have to change the Anchored Frame default setting from "Below Current Line" to "At Insertion Point".
Is there a way to make "At Insertion Point" the default option in FrameMaker 8 (.e.g *.ini file)?
Thanks,
-JHello again,
Okay, I took the plunge (followed the instructions) and put the ShrinkWrapAsIs.dll in the following folder:
C:\Program Files\Adobe\FrameMaker8\fminit\Plugins
But, it did not work on my version of FrameMaker 8 (in Structured FM8).
Thanks again for the ideas.
-J -
Workflow WS400012 Release for payment (frame)
Hi, I need to know if the WS400012 Release for payment (frame) is trigger when a invoice is register to
I need to know if workflow to shoot when a logistic invoice is registered from the MIRO transaction, since a book entry is registered (type RE),
I tested and single an the workflow to shoot with financial transactions (FB01, FB60), although I formed in the payment liberation the type of document RE.
Regards
DayanaHi,
Just go through the following links
1. http://help.sap.com/saphelp_nw04s/helpdata/en/fb/135d89457311d189440000e829fbbd/content.htm
2.http://aiokeh.wdf.sap.corp:1080/SAPIKS2/contentShow.sap_SCLASS=IWB_STRUCT&_SLOIO=9B4460FF454711D189430000E829FBBD&TMP_IWB_TASK=DISPLAY&RELEASE=647&LANGUAGE=EN&_SEQNUM=104&_LOIO=84CB8D3880B8E060E10000009B38F842&_CLASS=IWB_EXTHLP
<b>Reward Points if Useful</b> -
Stopping invoice Parking for Second time Parking for a frame work PO...
Hi SAP Guru's..
there is a Requirement from Client site that ..
for a Frame work PO which comes with a Invoice plan ..
we should be able to Stop Second time invoicing Maintained in Invoice Plan...
How to Go for this ...
Any workable suggestion would be Rewarded with Points ...
Thanks and warm Regards..
Adarsh Srivastava..You can control the changing of PO in the enhancement which name you can search here. There are three kinds of enhancement: check, change and save. You need select the kind of 'change'.
-
Stop motion chroma screen problem for multi frames
I am trying to use green screen for stop motion movies and I do know how to set it for each frame but how do you get all the frames to accept a single back ground picture at once? I have to insert the effect one at a time into each frame. I cannot use "select all" and then insert...the option will only work on single frames which for hundreds of frames is very time consumming. Is there a batch frames work around?
Thanks
KevinJust remember that doing the Paste Attributes will add ALL the effects from the copied clip to ALL of the selected clips. Any effects already applied to those clips will still remain expect for Adjust, Motion or Opacity keyframes, those will be overwritten.
Best to practice on one or two clips to see what the results will be before doing a large group of them. -
Here's a special request. As a publication designer, if I choose to have rules in my column gutters, it's real pain because I have to place those rules manually, style them and then move and/or lengthen/shorten them if my column's height or postioning changes.
How great would it be to have a "Gutter Rules" option in the Object Style specifications for text frames? You could specify the rule's style, width, colour, offset etc., and choose whether to have them extend to the full height of the box, or just to the height of the content, aligning it to x-hieght, base height and so on. Would love to see this feature in future versions of Adobe Indesign, and if anyone knows of a script, please let me know!Starting with Eugene's questions of 8/31: There are NO InDesign “embedded” footnotes, all the “notes” are simply text in a text frame. When they refer to a note reference in text, the note numbers at the start of the footnote are superscripted with a character style. Just for info, the notes without the superscript numbers at the start (25-35, 33, 35) are notes that refer to the line numbers.
Unfortunately using a rule above the first note in the frame won’t work all the time either. Just as the notes for the right page (6, 7 and 8) start on the left page and continue with note number 9 on the right page, a single long note can start on the left page and end on the right page. At that point we’d have to break the paragraph and restyle the 2nd half of the note with out the rule. We did this in another book and it was only a minor irritation. If this series though it would be a killer over the long haul.
After looking at it again last night for a while I think anchoring a rule in the first line of the footnote still seems to be the best way. It’s easy to place if a library is left open, I can script it if I find it necessary and it keeps the text flow in tact for possible later repurposing. Maybe the best place for the anchor is the middle of the line giving the best chance that it will stay in the right place if text moves a bit forward or backward. The one good thing about the way it anchors is that the anchor’s horizontal position doesn’t matter.
Thanks to both of you for your time and all the best.
Ken -
"Baud Rate" AttrId not found for CAN frame API's ncGetAttr and ncSetAttr
Hi,
Well, everything is in the Subject : "Baud Rate" AttrId not found for CAN frame API's ncGetAttr and ncSetAttr
Although it is listed in the LabVIEW Documentation, it is not in the enum's items gotten from `right click` -> `create` -> `contsant` on their `AttrId` connector.
My actuall need would be for checking a formerly opened CANNet handle compatibility against hardware requirement, so ... ncGetAttr.vi
Anyway, if somebody knows the actual u32 to hardwire instead of the enum constant, or did I get something wrong ?
ThanksHello,
You are quite right about the ncGetAttr.vi however the ncSetAttr does have a Baud Rate item if you scroll further down.
To get the Baud Rate wire a x80000007 to the AttrId pin. Or you can double click on the the ncSetAttr and then go into its block diagram, now
in the case structure select case 27 copy the numeric constant (which should be x80000007) and use it as the input to the ncGetAttr
Let us know if this helps.
Christian A
National Instruments
Applications Engineer -
Quick key launch for next frame in sequenced loop?
Hi,
I want go quickly through my sequence loop. Is there a key combo for next frame?
Thanks
Solved!
Go to Solution.ctrl + mousewheel will skip through frames in all structures
- Cheers, Ed
Maybe you are looking for
-
please. waiting for your replies.
-
Netflix Shows Only Blank Screen
This problem started two weeks ago. System: Windows XP Latest Firefox browser When I select a Netflix movie, it comes up as a blank screen. Previously I had been using Firefox and Netflix for years without any problems. I have uninstalled an reinstal
-
SC3.2 Quorum Server in S10 container?
Hi, Is it possible to have a single server act as a quorum device for several (test / development) clusters? If it's not supported by the software, perhaps by installing multiple copies of the software within S10 zones? TIA. Tom
-
Macbook air startup disk full, after removed 149GB pic folder
After I removed ALL pictures worth of 149GB, I still get the "startup disk full" message. It pops out all the time, more than frustrating, my air is not just a typewriter.
-
Here is a link to InDesign file: https://www.wetransfer.com/dl/t9kXGPob/2323bdb435d7931c8ebd46d9ad613ab469d474349777e9d4821 c32f00b423e4292a695bb3f7f830 Steps to reproduce problem: 1. Open file 2. Update Table of Contents 3. Save and close file. File