How to make only vertical scrollbar?

my codes are shown as the following 2 classes:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JScrollPane.*;
class showConsole2{
public static void main(String argv[])throws Throwable{
consoleFrame csf = new consoleFrame();
csf.show();
class consoleFrame extends JFrame{
public consoleFrame()throws Throwable{
super("Console"); setSize(150, 200);
JPanel p1, p2, p3, p4, p5, p6, content ;
p1 = new JPanel(); p2 = new JPanel();
p3 = new JPanel(); p4 = new JPanel();
p5 = new JPanel(); p6 = new JPanel();
content = new JPanel();
JLabel l1, l2, l3, l4, l5, l6;
l1 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
l2 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
l3 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
l4 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
l5 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
l6 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
p1.add(l1); p2.add(l2); p3.add(l3);
p4.add(l4); p5.add(l5); p6.add(l6);
content.add(p1); content.add(p2); content.add(p3);
content.add(p4); content.add(p5); content.add(p6);
setContentPane(content);

Here is the code :)
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JScrollPane.*;
class showConsole2{
public static void main(String argv[])throws Throwable{
     consoleFrame csf = new consoleFrame();
     csf.show();
class consoleFrame extends JFrame{
     public consoleFrame()throws Throwable
          super("Console"); setSize(150, 200);
          JPanel p1, p2, p3, p4, p5, p6,content;
          JScrollPane content1;
          content = new JPanel(new GridLayout(6,1));
          content1 = new JScrollPane(content);
          content1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          content1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
          p1 = new JPanel(); p2 = new JPanel();
          p3 = new JPanel(); p4 = new JPanel();
          p5 = new JPanel(); p6 = new JPanel();
          JLabel l1, l2, l3, l4, l5, l6;
          l1 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          l2 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          l3 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          l4 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          l5 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          l6 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          p1.add(l1); p2.add(l2); p3.add(l3);
          p4.add(l4); p5.add(l5); p6.add(l6);
          content.add(p1); content.add(p2); content.add(p3);
          content.add(p4); content.add(p5); content.add(p6);
          setContentPane(content1);
}Good Luck

Similar Messages

  • How to  make the vertical  scrollbar  moved  automaticlly?

    Hi:
      I make a  program using BDC to create  POs.
      In my bdc recording process, i only inserted a line material item ,  but now in my program i failed  to  insert material items  over <b>7</b> because the screen only have 7 lines in default situation. how to solve this problem?   thanks inadvance!

    Hi guixin chen
    But programming for the scroll bar is never a good idea...
    Simply because thsi depends on the GUI settings on OS settings of the user.
    and you cant possibly program to consider all this.
    The best option as somebody suggested is to use teh bapi/fm.
    If u r trying to add some items to the PO in BDC, you might also have the option through the menu to add a new item. use that instead of a scroll. This will make ur BDC GUI settings independant.
    Rgds,
    Prashanth.

  • How to make baseline vertical

    Hello All,
         how to make baseline vertical.
    Always baseline is horizontal i.e we can draw the text only in
    horizontal line . How to make baseline vertical . Is there any method
    in jdk1.1.8 to make baseline vertical.
    Can any one answere?
    Sharmila

    in 1.1.8, no
    AffineTransform (introduced in java1.2) allows an arbitrary transform to be applied to the origin, so it can be used to perform the task you want. However, this functionality is unavailable in <1.2 JREs.
    rob,

  • How to make a second scrollbar

    hello,
    I'm making an ipad version of a news paper in indesign but I have a little problem.
    I made a scroll bar for the menu so you can scroll through all the news.
    now I want to make a second scroll bar on the same page so when you click on an article you can scroll through the text.
    It doesn't work to make another layer in your Scrollable content and in your layer 1 and name them the same. Like I made the first scrollbar
    You also can't make a second layer called Scrollable Content.... so I have no idea how to make a second scrollbar
    please help me
    Thank you

    already got the answer ^^ thanks anyway but please help me with my other problem : http://forums.adobe.com/message/3977205#3977205

  • How to make only part of a PDF document editable?

    I'm looking to see if there is a way to make only part of a PDF document editable. My problem is, I have pieces of collateral that some of our channel partners need to be able to add their logo to and then edit the contact information on them, but we don't want them to be able to change any of the main copy on these documents. The only thing I've been able to come up with as a solution is to create outlines of the text that I don't want editable, but I need the copy to be able to be read by computer systems for disability purposes. Does anyone have any ideas on something I could do for this? Or has anyone dealt with anything like this? Any help would be greatly appreciated!

    Hi vward26,
    You can use Acrobat to make only part of a PDF document editable.
    Kindly refer this FAQ:http://tv.adobe.com/watch/acrobat-x-tips-tricks/how-to-convert-just-part-of-a-pdf-file/
    Regards,
    Florence

  • How to move the vertical scrollbar ?

    Hi
    How can I move a vertical scrollbar in the HTML page to a desired position.The position is actually a list tag element.?

    This is a Java forum. Java has nothing to do with Javascript.

  • How to make only video full screen

    Hi,
    I have been able to successfully set up my app to go full screen or back to original size upon 'escape'.  But, the whole app goes full screen, including my Lists, text areas, etc...  How can I make only the video go full screen?  I really appreciate any help I can get...
    Thanks in advance,
    K4Flex

    Keynote  >  Preferences  >  Slideshow:    Scale slides to fit display

  • How to make a Vertical Total of a multilline item?

    Hello,
    I have a block that contains 12 numeric multiline items. I would like to make a vertical total for each item.
    I tried to make a reference item, it didn't work. i tried also to make it by doing a Sum of my item, it didn't work neither.
    Could someone give me any ideas how to figure it out?
    thanks

    You use Summarized items for this:
    -Create a non-database-block, name it e.g. BL_CONTROL, set the property "Single record" to "Yes".
    -Create a number-item in the block, set the property "Calculation Mode" to "Summary", "Summary function" to "sum", and "Summarized Block" and "Summarized item" to your block/item you want to sum up.
    -Set the property "Query all records" to "Yes" on your database-block.

  • How to make only one round corner?

    HI,
    How can I make only one (or 2) round corner on a square using the round corner effect?

    You don't say what version you're using, but I know that in CS3 (and probably CS4), there is a script installed that you can use.
    Draw your frame. Open the Scripts panel. Open the subfolders "Application", then "Samples", then "Javascript". With your Frame selected, double-click the script in the list named "CornerEffects.jsx". You'll be presented with a list of options to control what type of corner; and at the bottom the pop-up menu controls which corners get that type of corner.
    (Names may vary somewhat for CS4.)

  • How to make only one column non reorderble

    I want to make only one column (Column 0) of my JTable non reorderble.
    I also want to make the same column non resizable and I want to give it a specific size.
    Please help me on this?

    I have implemented a RowHeaderTable class which displays 1, 2, 3, ... in the first column. The column is in the scrollpane's RowHeaderView, so it is not resizable nor reorderable. But its width can be set in your code. Maybe this is what you need.
    Use the class the same way you use a JTable, except 3 added methods:
    getScrollPane();
    setMinRows(int r);
    setRowHeaderWidth(int w);
    Note: The table works perfectly in skinless L&F, such as the default java L&F. It looks ugly in Liquid L&F because I don't know how to steal column header's UI to use on a JList. If someone can help me on this one, I thank you in advance.
    * RowHeaderTable.java
    * Created on 2005-3-21
    * Copyright (c) 2005 Jing Ding, All Rights Reserved.
    * Permission to use, copy, modify, and distribute this software
    * and its documentation for NON-COMMERCIAL purposes and without
    * fee is hereby granted provided that this copyright notice
    * appears in all copies.
    * JING DING MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
    * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
    * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
    * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. JING DING
    * SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT
    * OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
    import java.awt.BorderLayout;
    import java.awt.Component;
    import javax.swing.AbstractListModel;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.ListCellRenderer;
    import javax.swing.UIManager;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableModel;
    * @author Jing Ding
    public class RowHeaderTable extends JTable {
      private int minRows = 10;                         // Minimum size of the row header.
      private static final int DEFAULT_WIDTH = 30;
      private JScrollPane jsp;
      // The row header is a JList with the same appearance as the column header.
      private JList rowHeader;
      // Repaint row header whenever the table inserts or deletes rows.
      private TableModelListener tmListener = new TableModelListener(){
        public void tableChanged(TableModelEvent e){
          if(e.getType() != TableModelEvent.UPDATE)
            rowHeader.repaint();
      /** Create a new instance of RowHeaderTable.
       * @param model
      public RowHeaderTable(TableModel model){
        setModel(model);
        initializeHeader();
        jsp = new JScrollPane(this);
        jsp.setRowHeaderView(rowHeader);
      private void initializeHeader(){
        rowHeader = new JList(new AbstractListModel(){
          public int getSize(){ return Math.max(getModel().getRowCount(), minRows); }
          public Object getElementAt(int index){ return "" + ++index; }
        setRowHeaderWidth(DEFAULT_WIDTH);
        rowHeader.setFixedCellHeight(getRowHeight());
        rowHeader.setCellRenderer(new TableRowHeaderRenderer());
      public void setRowHeaderWidth(int w){
        rowHeader.setFixedCellWidth(w);
      public void setMinRows(int m){ minRows = m; }
      public void setModel(TableModel model){
        super.setModel(model);
        model.addTableModelListener(tmListener);
      /**Use this method to get the scrollPane, instead of new JScrollPane(table).
       * @return
      public JScrollPane getScrollPane(){ return jsp; }
      protected class TableRowHeaderRenderer implements ListCellRenderer{
        TableCellRenderer colHeaderRenderer;
        public TableRowHeaderRenderer(){
          JTableHeader header = getTableHeader();
          TableColumn aColumn = header.getColumnModel().getColumn(0);
          colHeaderRenderer = aColumn.getHeaderRenderer();
          if(colHeaderRenderer == null)
            colHeaderRenderer = header.getDefaultRenderer();
        public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean hasFocus){
          return colHeaderRenderer.getTableCellRendererComponent(
              RowHeaderTable.this, value, isSelected, hasFocus, -1, -1);
      public static void main(String[] args){
        try {
          UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
        }catch (Exception e){ e.printStackTrace(); }
        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)}
        DefaultTableModel dtm = new DefaultTableModel(data, columnNames);
        RowHeaderTable rht = new RowHeaderTable(dtm);
        rht.setMinRows(0);
        JFrame frame = new JFrame("RowHeaderTable Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(rht.getScrollPane(), BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);
        dtm.addRow(new Object[]{"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)});
        dtm.addRow(new Object[]{"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)});
        dtm.addRow(new Object[]{"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)});
    }

  • How to make only some open Invoices visible in Incoming Payments Wizard ?

    I want only to make only some Open Invoices visible in Incoming Payment. Can i use series (Document Numbering) ? Lets say I have SBO in 2 cities and want to user of city A only se open invoices of city A in incoming Payments , and user of city B to see only invoices created in city B . Any ideas ?

    You may use Project code to reach your goal.
    Thanks,
    Gordon

  • How to make only right handside scrollbar?

    in a frame, i just want to have the right handside scrollbar, and omit the bottom one?
    can anyone help? thanks!

    You can do it with a JScrollPane and set the horizontal scroll bar policy to never. You can put your component in place of the JTree here that I used as a sample.
    import java.awt.*;
    import javax.swing.*;
    public class TestFrame extends JFrame {
        public TestFrame() {
            JScrollPane scrollPane = new JScrollPane(new JTree());
            scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            getContentPane().add(scrollPane);
            pack();
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        public static void main(String [] args) {
            new TestFrame();
    }

  • How to add a vertical scrollbar?

    Been searching FOREVER now!
    How do I make a Tabbed panel with a fixed size, and then content is scrollable in vertical direction?
    like this site: Sigurd Rakel | Bilder
    Or inside a composition for that matter?

    There is a way of doing this using an iFrame. It’s not particularly elegant but it does work. The only caveat is you wouldn't be able to have the lightbox effect shown in the site you referenced, as it would appear within the panel's frame, rather than on the main page.
    Create your tabbed panel on the page. Make a note of the content area’s width.
    Now you need to create a new page for the content you want to display in the tab. I’ve created a Master page for this, as it will let you quickly create new content at with the correct settings.
    Open the Master's Page Properties. Set the page width to the width of the panel content area. Remove all padding and margins.
    Open the new master. Remove the header and footer padding.
    Go back to the Plan view. Create a new page based on the new master page. Also remember to remove the page from the menus!
    Add your content so it fits the width of the page.
    Go back to the page with the tabbed panel. Select Insert HTML from the Object Menu. Add this line of code (substituting the page name and panel dimensions for your own): <iframe src="panel-text.html" width="480" height="510" frameBorder=0 />.
    Position and resize the HTML frame inside the panel. The content won’t show in the frame as it’s referencing a page that’s yet to be rendered. You might also want to adjust the panel size to suit.
    Select Preview Site in Browser from the File Menu. All being well, you should see the content inside the panel, which will scroll independently.
    I hope this helps.
    David

  • IFrame - How to keep the vertical scrollbar, but NOT the horizontal one?

    I have the iFrame set-up fine in the site - http://www.pebbleplace.com/Personal/Start.html
    And it works as expected in Safari, but in Firefox a horizontal scrollbar shows up... How can I can keep the horizontal scrollbar from showing up? It's not needed - the content is skinnier the iFrame. This is the code currently being used -
    <iframe src=
    "http://www.pebbleplace.com/Personal/StartLatest_EntriesList.html"
    style="width:728px; height:408px;
    border-color:#990033;
    border-style:none;
    border-width:1px"
    scrolling="yes" >
    </iframe>
    I've seen some parameters such as "overflow-x:hidden" when Googling this topic, but I'm not sure where to place that command. Nor did it sound like it should be used in-line the code shown above. Coding is NOT my thing, so I really appreciate the help.
    Thanks

    Thank you. Unfortunately I had to pull the iFrame. It was on the front page and displayed all the "Latest Entries" list. I was using the iFrame as scrolling list box - this way I could keep all the entries on the front page. Right now there is only room ~10 entries.
    Anyway, I pulled the code because when I clicked on it, it opened the page inside the iFrame. That wasn't what I expected. I wanted it to open the page in the same Safari tab, not in the tiny iFrame. I'm kind bummed because it looked good and would have worked nicely - if it didn't open the links in the iFrame.
    I think I could trick it by linking to my pages as an external reference and forcing them to be opened in a NEW browser window. I may try that next weekend when I have more time to work on this again.
    Thank you for the response.
    John

  • How to make only one colour show.

    Okay so say I take some footage I just shot and I want the colour blue to ONLY show up and all the other colours turn black and white, how would I do this?
    so ONLY blue will be in the footage, the other colours are black and white.
    Thanks

    Welcome to the forum.
    As stated, Leave Color Effect is exactly what you want. I'd like to put in a bit of a plug for Adobe Classroom in a Book Premiere Pro CS5, Adobe Press, out very soon, if not already on shelves where you are. The author covers this very Effect very well. Doubt that you will find a better tutorial on the Effect anywhere else.
    Also, it's great reading, and a book worth every $.
    Good luck,
    Hunt

Maybe you are looking for