Adding JScrollPane doesn't work... hmm....

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(null);
        this.setSize(new Dimension(400, 300));
        this.setTitle("All Videos Own By Store");
        ta_show.setBounds(new Rectangle(30, 25, 320, 220));
        ta_show.setEditable(false);
        ta_show.setEnabled(false);
        JScrollPane scrollingArea = new JScrollPane(ta_show);
        getContentPane().add(scrollingArea);
        this.getContentPane().add(ta_show, null);
        //this.getContentPane().add(scrollingArea);
        this.setVisible(true);
    }ta_show is the JTextArea...
I will load a text file into the JTextArea and it should show the JScrollPane since the text file is quite large... But it doesn't show..
Any ideas?

try this for size:
    private void jbInit()
        JPanel p = new JPanel();
        p.setPreferredSize(new Dimension(400, 300));
        p.setLayout(new BorderLayout());
        int eb = 20;
        p.setBorder(BorderFactory.createEmptyBorder(eb, eb, eb, eb));
        ta_show.setPreferredSize(new Dimension(800, 600)); // or however big you want it
        ta_show.setEditable(false);
        //ta_show.setEnabled(false);
        JScrollPane scrollpane = new JScrollPane(ta_show);
        p.add(scrollpane, BorderLayout.CENTER);
        getContentPane().add(p);
    }

Similar Messages

  • JScrollPane doesn't work with Graphics

    Does JScrollPane work easily with Graphics?
    The GUI I am trying to create will have an indeterminate number of coloured blocks, so I need scroll bars to allow the full number of blocks to be seen. My test code, with just a few of blocks, is below.
    I have a class which contains the paintComponent(Graphics) method, and an object of that is put inside a JScrollPane and the whole lot is added to a JFrame. I have tried playing around with various sizes, and with various combinations of JFrame and JPanel, but the scrollbars don't allow me to scroll to see the full blocks. In the JScrollPane constructor I have declared them to be always visible so that I can see them, but they don't do anything.
    Should my ColorPanel class implement Scrollable? I'd like to avoid that, as it seems unnecessarily complicated. Has anybody got any ideas? Many thanks.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Graphics.*;
    import javax.swing.*;
    class ScrollTest extends JFrame
    {     private Toolkit tk = Toolkit.getDefaultToolkit();
         private Dimension d = tk.getScreenSize();
         int screenHeight = d.height;
         int screenWidth = d.width;
         public ScrollTest()
         {     super("Test");
              addWindowListener(new WindowAdapter()
                   {     public void windowClosing(WindowEvent e)
                        {     System.exit(0);
              setSize(screenWidth, screenHeight);
              Container contentPane = getContentPane();
              ColorPanel cp = new ColorPanel();
              cp.setPreferredSize(new Dimension(400, 400));
              JScrollPane scroller = new JScrollPane(cp,
                        ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
              JViewport vp = scroller.getViewport();
              vp.setViewSize(new Dimension(350, 350));
              vp.add(cp);
              contentPane.add(scroller, "Center");
         public static void main(String[] args)
         {     ScrollTest st = new ScrollTest();
              st.pack();
              st.show();
    class ColorPanel extends JPanel
         public void paintComponent(Graphics g)
         {     super.paintComponent(g);
              g.setColor(Color.red);
              g.fillRect(50, 250, 50, 500);
              g.fillRect(250, 50, 500, 50);
              g.setColor(Color.green);
              g.fillRect(50, 750, 50, 50);
              g.fillRect(750, 50, 50, 50);
    }

    I am having an almost identical problem . I am also building panels with custom graphics of indeterminate numbers of colored blocks, and so need scrollbars - or SOME way of being able to view everything, but have not been able to get it to work. i tried setting the preferred size of the panel, and setting the sizes of the scrollpane and its container as well..
    this problem has been plaguing me for a while - enclosing a panel with custon graphics in a scrollpane and getting the scrollbars to show up and function correctly. any help will be greatly appreciated!!

  • Satellite P300 - Value Added package doesn't work after computer restart

    Hi,
    I have got Toshiba Satellite P300 PSPCCA running windows vista ultimate 64x. I can not get my soft touch button working. I downloaded latetest TVA Package and installed it. After installation it asks for restart but I dont restart my laptop and I just perform Restart Flash Card and my soft touch button works all good which is mute, media player,etc. but once I restart my laptop it stops working.
    I have tryed uninstalling and reinstalling software but no luck. I have read in toshiba forum about running CCleaner and do fresh installation but still have same problem.
    Does any of you know how to fix it.
    BTW i have got AVG internet security software on my system but have have added toshiba folder to exclude from realtime scanning just in case if its causing problem but no luck. I have searched qurantine folder and its nothing in there.
    Please help me to get my soft touch button working.
    Thanks.
    Regards,
    Jay
    Message was edited by: Jay Padia

    Hello Jay
    I agree with Akuma. All you can do is to remove preinstalled VAP from the system and install latest version again. Why you didnt follow instruction to restart notebook after VAP installation?
    I have installed VAP several times on my Satellite P200 and Satellite A300 without any problems but after latest version installation I have restarted notebook immediately. The installations procedure was finished and needed processes started in the background. I presume this is the problem on your Satellite P300.
    If nothing helps the last step is to install OS again using recovery installations DVD. After doing this you will have clean preinstalled OS and everything will work well again.

  • Itunes File Sharing: Adding files doesn't work

    Hi,
    i have a problem adding files via Itunes File Sharing in Apps. Here's my setup:
    Windows 7 64bit, german
    Itunes 11.1.5.5, x64, german
    Iphone 5s, 32GB, directly attached via USB
    several apps with file sharing support (OpenVPN, VLC, Good Reader...)
    Now, when i choose one of the apps and click "Add...", i get a file selection dialogue, select a file and click 'ok'... that's it.
    Nothing happens. The file is not added to the window.
    It's not added to the phone after a sync, so it doesn't seem to be a display  problem. But i don't get an error message at
    any point, so i'm quite flattered where to start looking for the problem.
    Steps so far:
    Reinstallation Itunes - no effect
    Reinstallation Drivers - no effect
    Starting with a new media library - no effect
    The only thing suspicious are some bonjour errors in the windows logs. But even with disabled bonjour service the problem persists.
    I've searched for this in the forums but didn't find a proper thread/answer for this.
    Anyone coming up with an idea? At least where to look for the problem? Is there a log file/command line parameter/deep inside special genius trigger to pull? I'm getting out of options here. :/
    Thanks a lot!
    Regards from germany,
    l0calhost

    Problem solved. Complete deinstallation of ITunes, computer restart, telephone restart and finally reinstallation of the app did the trick.
    But still, how would you debug a problem like this, when no error message comes up at any point?

  • .mov files appear as Unix after recovery, adding extension doesn't work

    (Also posted in Quicktime forum)
    Whilst backing up (with Synchronise X) a drive, I accidentally clicked to allow around 15GB worth of Quicktime files to be deleted, in two folders.  Realising my mistake, I stopped the back up immediately, and recovered all the files with Disk Drill.  One folder recovered correctly, however the other folder recovered the files as 'Unix executable files'.  I have tried adding the .mov extension to these files, tried opening from within Quicktime, but always get the error message that the files are not a movie.  I tried telling the file to open with QT in the Get Info windoww, still without success.  All the files are of a size which seem to be about right for what they are supposed to be, but I cannot get them to open as movies.
    One observation: the files which recovered correctly all had '.mov' in their file names at the time of recovery, all those with which I am having a problem had no extension name showing.
    I've searched through these forums and elsewhere - most people get the files to work by adding the .mov extension, but for me this is not the answer.  Are there any more tricks?

    Thanks guys for your speedy suggestion, both of you!
    I tried QT Repair, and when that was unsuccessful, moved onto Media Salvage, as suggested by QT Repair.  The final report was that the media was seriously corrupted, so I had no success.
    It seems odd to me that the rescued files in one folder from the original delete are OK,  but those in the other folder are unrescuable, even though there was clearly no time to overwrite all those files before I cancelled the delete action.
    Fortunately they are backed up elsewhere, 5,000 miles away, but that's another story.

  • Dynamically adding ColumnSeries doesn't work

    I created the following code to create different series dynamically:
    <?xml version="1.0" encoding="utf-8"?>
        <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
            creationComplete="application1_creationCompleteHandler(event)"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
            <fx:Script><![CDATA[
                import mx.charts.series.ColumnSeries;
                import mx.collections.ArrayCollection;
                import mx.collections.Sort;
                import mx.collections.SortField;
                import mx.events.FlexEvent;
                [Bindable]
                public var Loc01:ArrayCollection = new ArrayCollection([
                    {date:"2002", close:41.87, loc: "Location 01"},
                    {date:"2005", close:48.06, loc: "Location 01"},
                    {date:"2006", close:48.06, loc: "Location 01"},
                    {date:"2002", close:157.59, loc: "Location 02"},
                    {date:"2003", close:160.3, loc: "Location 02"},
                    {date:"2003", close:45.74, loc: "Location 01"},
                    {date:"2004", close:42.77, loc: "Location 01"},
                    {date:"2004", close:150.71, loc: "Location 02"},
                    {date:"2002", close:45.74, loc: "Location 03"},
                    {date:"2003", close:42.77, loc: "Location 03"},
                    {date:"2004", close:150.71, loc: "Location 03"},
                    {date:"2005", close:156.88, loc: "Location 02"}
            protected function application1_creationCompleteHandler(event:FlexEvent):void
                // TODO Auto-generated method stub
                var obj:Object;
                var arr:Array = [];
                var i:int;
                var ac1:ArrayCollection;
                var NS:ColumnSeries;
                var sortA:Sort = new Sort();
                var sortByLocation:SortField = new SortField("loc",false,false,false);
                var sortByDate:SortField = new SortField("date", true, false, false);
                sortA.fields=[sortByLocation, sortByDate];
                Loc01.sort=sortA;
                Loc01.refresh();
                i=0;
                arr[i] = Loc01[0].loc;
                for each(obj in Loc01){
                    if(arr[i] != obj.loc)
                        i++;
                        arr[i] = obj.loc;
                var str: String;
                i=0;
                for each(str in arr){
                    ac1 = new ArrayCollection();
                    for each(obj in Loc01){
                        if(str == obj.loc)
                            ac1.addItem(obj);
                    ac1.refresh();
                    if(!myChart.series[i])
                        myChart.series.push(new ColumnSeries());
                    NS = myChart.series[i];
                    NS.dataProvider = ac1;
                    NS.yField = "close";
                    NS.horizontalAxis = h1;
                    NS.displayName = str;
                    NS.verticalAxis = v1;
                    NS.id = "cs" + i.toString();
                    i++;
        ]]></fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:Panel x="49" y="30" width="868" title="Column Chart With Multiple Axes">
            <!--mx:Legend width="769" dataProvider="{myChart}"/-->
            <mx:ColumnChart id="myChart" width="601" showDataTips="true" dataProvider="{Loc01}">
                <mx:horizontalAxis>
                    <mx:CategoryAxis id="h1" categoryField="date"/>
                </mx:horizontalAxis>
                <mx:horizontalAxisRenderers>
                    <mx:AxisRenderer placement="bottom" axis="{h1}"/>
                </mx:horizontalAxisRenderers>
                <mx:verticalAxisRenderers>
                    <mx:AxisRenderer placement="left" axis="{v1}"/>
                </mx:verticalAxisRenderers>
                <mx:verticalAxis>
                    <mx:LinearAxis id="v1" minimum="30" maximum="170"/>          
                </mx:verticalAxis>
                <mx:series>
                    <mx:ColumnSeries id="cs0"/>
                </mx:series>
            </mx:ColumnChart>
        </mx:Panel>
    </s:Application>
    The hard coded ColumnSeries (the first one) works fine, but the next series which are created dynamically don't work. What's wrong in my code? Any help would be much appreciated.

    I replaced the following part of the code:
         if(!myChart.series[i])
              myChart.series.push(new ColumnSeries());
    with the following lines:
         if(!myChart.series[i])
              var tmp:Array = myChart.series;  
              tmp.push(new ColumnSeries()); 
              myChart.series = tmp;  
              myChart.invalidateSeriesStyles();
    And it works fine now.

  • Adding contacts doesn't work

    Just downloaded skype. Instructions -which are impossible to find- say to click on People icon on the left and then to click on the + on the right to add contacts. Clicking on Peopke does nothing.
    How do you add contacts???

    Hi
    Have you tried logging out of AIM and logging back in again.
    Tony

  • Dynamic adding of components (doesn't work when programmatically)

    Hi, I don't understand, why this doesn't work. I'll explain it on this example:
    import java.util.concurrent.ScheduledThreadPoolExecutor;
    import java.util.concurrent.TimeUnit;
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    public class NewFXMain extends Application {
        Group root;
        public static void main(String[] args) {
            Application.launch(NewFXMain.class, args);
        @Override
        public void start(Stage primaryStage) {
            primaryStage.setTitle("Hello World");
            root = new Group();
            Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
            Button btn = new Button();
            btn.setLayoutX(100);
            btn.setLayoutY(80);
            btn.setText("Add button now");
            btn.setOnAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                    addButton();
            root.getChildren().add(btn);  
            primaryStage.setScene(scene);
            primaryStage.setVisible(true);
            System.err.println("Number of buttons before: "+root.getChildren().size());
            ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
            executor.schedule(new MyTask(), 5, TimeUnit.SECONDS);
        private void addButton() {
            System.err.println("Button adding");
            root.getChildren().add(new Button("YEAH"));
            System.err.println("Number of buttons after: "+root.getChildren().size());
        class MyTask implements Runnable {
            public void run() {
                addButton();
    }There are two ways how a new button can be added. Either by clicking on existing button or programmatically by the program itself after 5 seconds.
    If you add it by button, there is no problem. The error print is:
    Number of buttons before: 1
    Button adding
    Number of buttons after: 2
    But if you just wait, then the error print is:
    Number of buttons before: 1
    Button adding
    and no button is added. In fact, the error printing after the adding isn't performed either.
    I'd like to ask if there is some solution for this because I'd love to do some changes by schedulers. Thx
    Edited by: 876949 on 14.8.2011 9:09
    Edited by: 876949 on 14.8.2011 9:11

    No, these are not error messages, they are just for purpose of example. Here it doesn't matter whether err or out... (yes, 'out' would be better ;)
    But thanx, it's working. By the way, I am creating scheduler for task lists. They are supposed to be printed dynamically in specific time (or periodically). For example: at 5 o'clock I need to print 5 items of some list and every 3 hours I need to print 3 items of another list etc. - so it's quite dynamic with regard to component adding (No, I don't want to use some sort of ListView, I want interactive printing: one item on screen at a moment). I'll try to work your solution into my code.
    Edit: So either it's not possible to use this for the purpose of my app or it will be really cumbersome. Maybe it would be easier to draw some rectangles with mouse listeners...
    Edit: So I finally got around it. In the end, I won't use dynamic adding as intended. It's working and that's important.
    Edited by: 876949 on 14.8.2011 12:48
    Edited by: 876949 on 15.8.2011 5:21

  • [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

    When selecting a menu item I used to click the left mouse button and hold it down, move the pointer to the desired menu item and release the mouse button. Everything works fine in the mine menu, but there's a problem when adding new adjustment layer from the layer panel: when I release the button nothing happens, I have to press the button again. In previous PS version it worked fine. How can I fix this?

    I don't think that is user fixable, meaning you'll have to wait till adobe fixes it with an update.
    Photoshop cc 2014
    windows does not work
    mac does work
    Did you already post over here:
    [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

  • [svn:osmf:] 15000: Fix for FM-447 : Adding CuePoint in TemporalFacet event listeners doesn't work

    Revision: 15000
    Revision: 15000
    Author:   [email protected]
    Date:     2010-03-24 14:01:02 -0700 (Wed, 24 Mar 2010)
    Log Message:
    Fix for FM-447 : Adding CuePoint in TemporalFacet event listeners doesn't work
    Ticket Links:
        http://bugs.adobe.com/jira/browse/FM-447
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/metadata/TimelineMetadata.as

  • [svn:osmf:] 14975: Fix for FM-447 : Adding CuePoint in TemporalFacet event listeners doesn't work

    Revision: 14975
    Revision: 14975
    Author:   [email protected]
    Date:     2010-03-23 17:04:43 -0700 (Tue, 23 Mar 2010)
    Log Message:
    Fix for FM-447 : Adding CuePoint in TemporalFacet event listeners doesn't work
    Ticket Links:
        http://bugs.adobe.com/jira/browse/FM-447
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/metadata/TimelineMetadata.as

  • I have several albums in my library that I cannot get onto my device. I have tried manually adding the albums, but it doesn't work. I can view the albums in "Music," but when I click on "iPhone" they are gone. How can I transfer them over?

    Can't add albums in library to iPhone.

    Full question: I have several albums in my library that I cannot get onto my device. I have tried manually adding the albums, but it doesn't work. I can view the albums in "Music," but when I click on "iPhone" they are gone. How can I transfer them over?

  • I have several separators that appeared in my bookmarks list without me adding them. How do I delete them? I already tried right click/cut, right click/delete in the bookmark menu-that doesn't work.

    I have several separators that appeared in my bookmarks list without me adding them. How do I delete them? I already tried right click/cut, right click/delete in the bookmark menu and directly on the list-that doesn't work.

    If you can't delete them in the normal way in the Bookmarks Manager then you may have a problem with the file places.sqlite.
    See http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
    See also [[Deleting bookmarks]]

  • Music adding doesn't work?

    My Music adding doesn't work?
    I try to add music from my usb but it doesn't work.
    I have 2Gen Ipod TOUCH 4.2.1 i think.

    Roger, FYI, the very first time I laid a music bed in it worked like a charm. I selected the music track, chose audio on the clip edit menu, and then I raised the other tracks to 100% (which is my main video) and lowered the audio for the music track to 12% and it worked perfectly. My audio was indeed under the main video, just the way I wanted it.
    Righ now I have gone to my original track in Garage Band, and lowered the entire thing significantly and will try using that. I'll get there. But great suggestion on Garage Band---I've never used it but figured it out pretty quickly.

  • Added or ediited texts by Bluebeam Revu,and has been saved,when I open it by the Adobe reader version 8.1,why it does not show my texts added by Revu?8.1 is my favorite version,I also tried it in a later version fo Reader,it doesn't work too!

    Added or ediited texts by Bluebeam Revu,and has been saved,when I open it by the Adobe reader version 8.1,why it does not show my texts added by Revu?8.1 is my favorite version,I also tried it in a later version fo Reader,it doesn't work too!

    Bernd Alheit wrote:
    Looks like a problem of Bluebeam Revu, not Adobe Reader.
    The response above is only a speculative answer to the original question. DSI-Hal, did you try to flatten the text in Bluebeam Revu prior to opening it in Adobe. This has worked for me on several different documents but not sure if we are using the same version of Adobe Reader.
    Give it a shot. Good luck.

Maybe you are looking for

  • How can we clone the Oracle database in new Oracle Home

    Hi, I would like to clone oracle database into new oracle home. How can we set it using OEM. I am using 10g grid control. Target db is on solaris Thanks Naveen

  • File Permissions on Oracle Directories for other Operating System Users

    Hi, I am trying to export the table data to flat file using a pl/sql function using UTL_FILE package and directories created using 'CREATE DIRECTORY' command. The function is called from a stored procedure which in-turn is called from a Java program

  • Problem with ABAP QUERY LDB

    Hi to all, I am using LDB for ABAP Query. For this I given selection fields. I don't want selection screen as like standard one. Ex. For QM11 transaction what ever screen appering like that my query smae appering . Please give solution for this. I wa

  • Do I need firewall/antivirus/spyware programs on a mac?

    I hope this is in the right place. Can anyone tell me if it is necessary to have any sort of anti-virus software, spyware software and/or extra firewall installed on a mac, and if so, which ones? I've been trying to research the matter and I keep com

  • Compiling Java Applets

    Hi! I've had some trouble running Java Applets on my server. After some debugging I have found that it maters how and/or where they are compiled. I have taken a simple HelloWorldApplet and compiled on my server. Then when I try to access it from a cl