How to make vertical-only scrollBar?

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);
//how to modify the codes in this program to make
//the vertical-only scrollbar?

Try this. I believe this is what you were asking. If not, let me know...
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JScrollPane.*;
class test
     public static void main(String argv[])
          consoleFrame csf = new consoleFrame();
          csf.setVisible(true);
class consoleFrame extends JFrame
     public consoleFrame()
          super("Console");
          setSize(150, 200);
          JPanel p1 = new JPanel();
          JPanel p2 = new JPanel();
          JPanel p3 = new JPanel();
          JPanel p4 = new JPanel();
          JPanel p5 = new JPanel();
          JPanel p6 = new JPanel();
          JLabel l1 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          JLabel l2 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          JLabel l3 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          JLabel l4 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          JLabel l5 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          JLabel l6 = new JLabel("aaaaaaaaaaaaaaaaaaaaaaa");
          p1.add(l1);
          p2.add(l2);
          p3.add(l3);
          p4.add(l4);
          p5.add(l5);
          p6.add(l6);
          JPanel content = new JPanel();
          content.setLayout(new GridLayout(6,1));
          content.add(p1);
          content.add(p2);
          content.add(p3);
          content.add(p4);
          content.add(p5);
          content.add(p6);
          // how to modify the codes in this program to make
          // the vertical-only scrollbar?
          JScrollPane jsp = new JScrollPane();
          jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
          jsp.setSize(200, 100);
          JViewport view = new JViewport();
          view.setView(content);
          jsp.setViewport(view);
          this.getContentPane().add(jsp, BorderLayout.CENTER);
          this.setSize(200, 100);
}

Similar Messages

  • Anyone know how to make vertical text in a table in keynote?

    anyone know how to make vertical text in a table in keynote?

    Just to add a bit more about this question. I have seen in other related questions that this feature (vertical text) is not available in (apparently) the whole iWork09. someone even said that it should be asked to the developers, so they include this feature in iWork10. I find this issue a bit sad. This feature has been present in msOffice since a while, and at least for me, this is quite important for my work. It is also apparently not possible to have different page orientation in the same document, meaning portrait and landscape, so one can have wide tables in a whole page, for example. If this is true, it is again sad, and I just cannot understand why such a basic feature is not available in an already 09 version. I am using only the trial version of iWork, but already in the first day I have discovered that I actually cannot do what I was used to. Again sadly I (and many others I guess) will have to stick to Office until the mac software is fully developed.

  • How to make read only field in Task list?

    Hi All,
    How to make read only field in Task list?

    This can be done one of two ways:
    1. Customize the form in Infopath, right click your field and disable the control.
    2. Use JavaScript/jQuery on the page to disable the element.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • 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 FileChooser only  have a Folder to choose?PLs help

    Dear Java expert!!Anyone know how to make user to choose it content from a single folder only...Pls advice
    this is my program..
    `````````````````````````
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.*;
    import java.io.*;
    import java.util.*;
    import java.net.*;
    public class Test2 extends JFrame {
         JFileChooser chooser = new JFileChooser();
         TextPreviewer previewer = new TextPreviewer();
         JPanel previewPanel = new PreviewPanel();
         class PreviewPanel extends JPanel {
              public PreviewPanel() {
                   JLabel label = new JLabel("Text Previewer",
                                                 SwingConstants.CENTER);
                   setPreferredSize(new Dimension(250,0));
                   setBorder(BorderFactory.createEtchedBorder());
                   setLayout(new BorderLayout());
                   label.setBorder(BorderFactory.createEtchedBorder());
                   add(label, BorderLayout.NORTH);
                   add(previewer, BorderLayout.CENTER);
         public Test2() {
              super("Accessory Components");
              Container contentPane = getContentPane();
              JButton     button = new JButton("Select A File");
              contentPane.setLayout(new FlowLayout());
              contentPane.add(button);          
              chooser.setAccessory(previewPanel);
              chooser.addPropertyChangeListener(
                                                 new PropertyChangeListener() {
                   public void propertyChange(PropertyChangeEvent e) {
                        if(e.getPropertyName().equals(
                             JFileChooser.SELECTED_FILE_CHANGED_PROPERTY))
                             previewer.update((File)e.getNewValue());
              button.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        chooser.showOpenDialog(null);
         public static void main(String a[]) {
              JFrame f = new Test2();
              f.setBounds(300, 300, 300, 75);
              f.setVisible(true);
              f.setDefaultCloseOperation(
                                            WindowConstants.DISPOSE_ON_CLOSE);
              f.addWindowListener(new WindowAdapter() {
                   public void windowClosed(WindowEvent e) {
                        System.exit(0);
    class TextPreviewer extends JComponent {
         private ImageIcon icon;
         private JTextArea textArea = new JTextArea();
         public TextPreviewer() {
              setBorder(BorderFactory.createEtchedBorder());
              setLayout(new BorderLayout());
              add(new JScrollPane(textArea), BorderLayout.CENTER);
         public void update(File file) {
              textArea.setText(contentsOfFile(file));
              if(isShowing()) {
                   textArea.revalidate();
         static String contentsOfFile(File file) {
              String s = new String();
              char[] buff = new char[50000];
              InputStream is;
              InputStreamReader reader;
              URL url;
              try {
                   reader = new FileReader(file);
                   int nch;
                   while ((
                        nch = reader.read(buff, 0, buff.length)) != -1) {
                        s = s + new String(buff, 0, nch);
              catch (java.io.IOException ex) {
                   s = "Could not load file";
              return s;

    If you need to use a JFileChooser to select a folder, not a file, use:
    JFileChooser jf = new JFileChooser();
    jf.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    Now, your file chooser is a directory chooser....

  • HT200131 how to make sure only my laptop can connect to my apple tv?

    I don't want to see my flatmate apple tv under "connect"
    how to make sure I don't click on his tv accidentally and he won't be able to connect mine?
    thank you!

    Hey J-Justin,
    Great question! You can name your Apple TV to differentiate it from others in the AirPlay list:
    Apple TV: Change the name of your Apple TV - Apple Support
    http://support.apple.com/en-us/HT200028
    Furthermore, you can setup an onscreen code or password to restrict access for AirPlay. The password method sounds like the best option for your setup:
    Apple TV (2nd and 3rd generation): Understanding AirPlay settings - Apple Support
    http://support.apple.com/en-us/HT202618
    Set a password
    Go to Settings > AirPlay > Security > Password > [set password]. You can use this setting to require a password for AirPlay-enabled devices to connect using AirPlay on the Apple TV. Use this setting if your device will need permanent access and you only want to enter the password once.
    Thanks,
    Matt M.

  • How to make vertical flip of video webcam.

    Hi all.
    I am using logitech webcam, i can show video and take piture well.
    Now i want to make vertical flip of video.
    They can do it ? If you have any experience, please help me.
    Thanks.
    Diego

    Well, I really see 2 avenues you can go down...
    The "proper" way to do it would be to create a custom "effect" that would flip the video frames inside the processor. You'd want to base this off the following example code:
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/RotationEffect.html]
    The "easy" way to do it would be to render the graphics yourself. You would just essentially need to create a class that implements the "VideoRender" interface (probably extending a JPanel implementing VideoRenderer), and use the BufferToImage class inside the "process" function to convert the inputted buffer object into a BufferedImage, which you would then render to the JPanel upside down... This probably sounds more complicated than it is, however... Process gives you a frame as a buffer, you use a utility to convert the buffer to an image, and then you draw the image to the screen. Quite a simple procedure, really...
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/apidocs/javax/media/renderer/VideoRenderer.html]

  • ALV - how to make selectable only some rows on an ALV?

    Hi my problem is:
    I have an ALV GRID as output of a report.
    I have to make selectable only few rows based on the contents of a field (showed in a column in the ALV).
    Is it possible?
    Best Regards, Vincenzo

    I did understand, but as i told you there is nothing like that, neither an option nor an event to capture.
    Here is the documentation: http://help.sap.com/saphelp_erp2005vp/helpdata/EN/bf/3bd1369f2d280ee10000009b38f889/frameset.htm
    Read it and choose what you need and what is in existance.

  • How to make vertical scrollbar visible for listbox which shows one entry only?

    I have resized listBox to display only one entry of char* items. As there is only one item displayed vertical scrollbar is not visible. Is there a way to show the scrollbar when listbox display is sized to show only one item?
    Using up/down arrow it does scroll through other entries.
    CLD,CTD

    The only problem using ring instead of listbox is that when there is a lot of items it pulls down the ring and hids all the other GUI items behind it. 
    Real estate was one reason of using list box and displaying one value. I did change the list box as a control instead of indicator but still cant get the scrollbar funcitonality.
    ANy other suggestion, thanks!
    CLD,CTD

  • How to make a only one spectified type object running at the same time ?

    I want to run specified function with java program in unix,AIX environment.But i want only one specified type object can run at this time when i make command "java xxx &" several times at this time.I had used thread but it can not work. I think there are two processes for system so it can not work. Which class or way in java can i use for this problem ? or I use thread in the wrong way.
    please help me . thank you everybody !!!
    ps:the command "java xxx &" mentioned above,xxx is name of java program ,
    & means command run in background.

    RMI is a good option you can think of. There is one registry and only one object can be bound to it with a specified name. But if your application is large, RMI calls can really slow down your application.
    Another option is to use Sockets. When you load the application check if you can start a server socket on a particular port. If you can, then start the program. If not, another application is already running. So exit your program. The socket you have created will be used only to bind to a particular port. In any system, there can be only one socket bound to a port and this guarantees the single instance running. When your application closes, close the socket too.

  • I need help. how to make vertical drop down menu

    I need help. I want on my site to make navigation as such on this site http://www.website24.eu/einstieg/. if you can help me and explain how?

    like this http://www.jqueryrain.com/?3khGEoMY

  • How To Make Printer Only Use One Color From the Cartridge?

    Several weeks ago I had accidetnally found the settings, and now can not for the life of me find it. I want to make the default settings of the printer to only print in blue, so It only uses blue from the ink and will only print blue stuff. Its a multi colored image, and only want it to print the blue. its not just text i can change to blue.  Any ideas, I checked the printer properties and preferences, cant find it. I have a MG3120 and windows 8

    Hello. Please try the following steps to adjust the color settings: 1. Close all programs that are open.2. Click Start and open the Control Panel.3. Open Printers or Devices and Printers.4. Right-click the MG3100 and choose Printing Preferences.5. In the Main tab, change the Color/Intensity to Manual.  Then click Set. Once there, you can adjust the color settings as desired. This didn't answer your question or issue or need additional assistance? Find more help at Contact Us.  

  • How to make Vertical Text start furom left to right?

    Sometimes some customers must be vertical text from left to right
    This is mainly for Asian fonts
    Whether it can be achieved with script,Or are there other methods?
    Thank you~

    @喜狼_edny – hm. Possible, but the result is somehow unsatisfactory.
    See for yourself.
    We could start with some text right aligned in a table with just one single cell:
    We could rotate the cell to 270° like that:
    Code:
    var myCell = app.selection[0].tables[0].cells[0];
    myCell.rotationAngle = 270;
    And now we need the text direction from right to left and all characters rotated to 180°:
    Code:
    var myCell = app.selection[0].tables[0].cells[0];
    myCell.rotationAngle = 270;
    myProperties = {
        composer : "$ID/HL Composer Optyca",
        characterDirection : CharacterDirectionOptions.RIGHT_TO_LEFT_DIRECTION,
        paragraphDirection : ParagraphDirectionOptions.RIGHT_TO_LEFT_DIRECTION,
        characterRotation : 180
    myCell.texts[0].properties = myProperties;
    Result:
    Ugh! Not exactly the result we expected…
    (Tested with InDesign CS5.5 on OSX 10.6.8)
    It's the characterRotation that is not working as expected.
    Uwe
    Message was edited by: Laubender

  • How to make "weekday only" recurring event?

    I am new user of the iPad and iPhone and noticed that I could not set recurring event to M-F only like my Blackberry had. Any recommendations from anyone?
    Thanks in advance for any direction.

    Two options:
    First, check what you can do in your desktop calendar application. I can create such events in iCal on my Mac and they sync correctly to the Calendar app on my iPad and on my iPhone.
    Second, the brute force approach. When all else fails you can create 5 separate repeating events, one each on Monday, Tuesday, Wednesday, Thursday and Friday. Not the best option by any means but it does work.

  • How do make sure only legitimate people an get into Conference using SX20

      Customer Scenario-( I) :Customer has SX20 registered with CUCM9.x, there is no TP Server and no TMS for Scheduled conference.
     I understand the concept of secure conferencing but this would be between the Endpoint and the Server-UC Application:
    Secure conferencing is a way to use regular conferencing to ensure that the media for the conference is secure and cannot be compromised. There are various security levels that a conference can have, such as authenticated or encrypted.
    With secure conferencing, the devices and conferencing resources can be authenticated to be trusted devices, and the conference media can then be encrypted so that every authenticated participant sends and receives encrypted media for that conference.
    However, like to understand if it possible at User Level as well by prompting the user to enter login credentials for getting into the conf call.
    Please Note, its not a scheduled conf call scenario. Its a typical Rendezvous conf example:
      Query1: Is there some provision where in if some one dials into SX20 from internet (outside corporate network), to ensure only legitimate people can get into MultiSite conference (3+1), calling party (who dials into SX20) needs to enter credentials (UserName & Password) for Authentication?
     Query2: If Query 1 is not possible using Rendezvous conf, then is it possible using Schedule conference with TP server and TMS or just by using TP Server ?
    Thanks & Regards
    Sumit Bhargava

    If someone is dialling in to your SX20, then you have the option to answer the call or not (assuming you don't have it set to auto-answer) - it's then up to your user to accept someone in to, or reject someone from, their conference.

Maybe you are looking for

  • How do I download pictures from icloud backup to a new device

    I just bought a new iPad yesterday because my iPhone was stolen a few weeks ago.  That phone was backed up to iCloud.  How do I get the pictures from iCloud back up to my new iPad?  I heard there is a short time period to retrieve them and I may be o

  • The cluster resource 'SQL Server' could not be brought online error while in completion stage of sql server 2012 failover installation

    While installing sql server 2012 with failover clustering I got the following error: The cluster resource 'SQL Server' could not be brought online. Error: There was a failure to call cluster code from a provider. Exception message: Generic failure. S

  • Installing the factory image from linux

    Currently I have Cianogenmod, since I'm getting tired of it, I want to go back to the factory image, if possible the lollipop one directly. I tried the emma tool, but I'm behind a very ugly firewall and it couldn't connect to the internet. How can I

  • Dropdown Binding with WSDL

    Hi all, I am trying to populate values in  dropdown using WSDL data connection.I bind Item with data connection field in object palette , i put item text = $ and item value =  $ . What else i need to do to populate field value in drop down dynamicall

  • Shockwave Flash plug-in crashing

    Lately, I've been getting the following message:  "The following plug-in has crashed: Shockwave Flash" in a yellow bar near the top of my browsers.  I get the same error in chrome, IE8, Firefox, etc. When I go into control panel --> Flash Player -->