Tricky little JScrollPane problem
I have a JScrollPane that contains a JPanel with BorderLayout called "mainPanel".
I have a kind of web appearance with a left child panel of vertical JLabels, a north child panel for title, and a center child panel as a work area inserted into "mainPanel". Simple enough!
The problem is in the center panel, when I insert a child JPanel into it with either FlowLayout or VerticalFlowLayout withthe panel extending completely across the center panel from left to right.
This child panel is hidden-to-the-eye panel because of the background being color same as center panel.
I then add controls to the child panel.
The problem is the scrollbars appear for the child panel that extends the full width of the center panel, instead of the controls, which I DONT want. I want the scrollbar to only show for the controls.
How can I get JScrollPane to ignore child JPanels like it does with the top level JPanel "mainPanel".
thanks
There's a post around from a couple of years ago where I tried to get flowlayout to behave in a scrollpane. I got it to work fairly well, but eventually gave up. I think the real answer is to not use flowlayout in a scrollpane, but you can search for that post if you want.
Similar Messages
-
Little "big" problem with Reports 9i...
Hi to all.
I've a little "big" problem when i launching reports on the web. The reports services it's under SUN Solaris 5.9 and de 9iAS 9.0.2. Well when i launch the report the reports server give me this error: "REP-108: File '/tmp/pfj66590734.gif' not found.".
The report have a chart, and the chart it's the problem, if i delete the graph(chart) the report run fine. In the Reports Server file config in the tmpDir, have specified this directory but, not find the gif.
Can be a problem of the chart with the reports engine?
I don't know.
Anybody have which that's the problem.
Thanx in advance. Oscar.I was facing the same problem when running a report with embedded chart graphics, and every time we tried running it we got an error message like the one below, where the gif file name changed every time:
REP-108: File 'd:\ora9ias\reports\temp\pfj30143486.gif' not found
Our solution was:
After a lot of research and troubleshooting we found out that if we compiled the report in a different machine (the developers') and deployed to the server it worked fine, the problem was the settings (registry and path variables) in the machine that was compiling the report (Our software release machines). I can't say exactly what were the settings changes right now, but try under someone else's machine, its the configuration of reports builder.
Hope this helps. -
Dear all,
I have a little bit problem with verify my apple ID, I don't get any message for verification aplle ID from Apple. Why? Anyone can help meHi Tep Virak,
Thanks for visiting Apple Support Communities.
You may want to log into your Apple ID first to double-check that it's the right email address and re-send the verification email using these steps:
Sign in to My Apple ID to manage your account information.
Click Resend under Primary Email Address.
From:
Apple ID: Associating and verifying email addresses with your Apple ID
http://support.apple.com/kb/he68
All the best,
Jeremy -
Hello. I have been trying to get the JScrollPane working on this project with little success. The problem is, the center panel draws a picture based on user dimensions and the picture can get quite big, which draws partially off screen. Is there a way to add a scrollpane to the entire frame or individual panels based on the redrawn size? If so, how do I apply it to the specific code shown below?
import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
* This class constructs the frame on screen.
public class DViewer extends JFrame {
private static JFrame frame;
private static JPanel dDPanel;
* Construct frame and panels
public DViewer() {
super();
frame = new JFrame();
frame.setSize(Toolkit.getDefaultToolkit().getScreenSize());
frame.setTitle("Designer");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
dDPanel = new JPanel(new BorderLayout());
dDPanel.add(new DComponent(), BorderLayout.CENTER);
dDPanel .add(new UserDI(), BorderLayout.NORTH);
dDPanel .add(new USOptions(), BorderLayout.WEST);
dDPanel .add(new Selecter(), BorderLayout.SOUTH);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
frame.add(dDPanel );
frame.setVisible(true);
public static void repaintD() {
BorderLayout layout = (BorderLayout) dDPanel.getLayout();
dDPanel.remove(layout.getLayoutComponent(BorderLayout.CENTER));
dDPanel add(new DeckComponent(), BorderLayout.CENTER);
frame.revalidate();
frame.repaint();Hi, yes it's possible. Have a look at this chapter of the Swing tutorials: How to Use Scroll Panes (The Java™ Tutorials > Creating a GUI With JFC/Swing &gt…
-
Obnoxious JTextPane and JScrollPane problem.
I have written a Tailing program. All works great except for one really annoying issue with my JScollPane. I will do my best to explain the problem:
The program will continue tailing a file and adding the text to the JTextPane. When a user scrolls up on the JScrollPane, the program still adds the text to the bottom of the JTextPane and the user can continue to view what they need.
Here is the problem: I have text being colored throughout the text pane. For instance, the word ERROR will be in red. The problem is when the program colors the text, it moves the scroll pane to the line where word that was colored is at. I don't want that. If the user moves the scroll bar, I want the scroll bar to always stay there. I don't want the program to move to the text that was just colored.
Is there a way to turn that off? I can't find anything like that anywhere.Coloring text will not cause the scrollpane to scroll.
You must be playing with the caret position or something.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting. -
I have just uploaded a new site which has been created using Dreamweaver CS4 for Windows. There is no problem viewing the site in IE 8, or in Firefox.
The site is basically a gallery of images. For some of the main images I've used little magnifying glass 'plus' symbols, which are simply linked rollover png images that take you to a larger version of the image. In IE7 (and I presume in older versions too) these little symbols aren't displaying in the correct position on each of these pages, they've jumped and are incorrectly displaying over the top, left corner of the main image.
Here's the link:
www.sjcillustration.com
Firstly, why is this happening in IE7 and yet all's fine in IE8 or in Firefox, and secondly, can anyone tell me how to fix it please?
(I was going to attach the corresponding CSS file but don't see an attach file button.......)
Cheers!Hi Cristian, thanks for responding so speedily!
On the homepage, click on the 'diagrammatic' thumbnail for example, then click on the 'volcano' thumbnail, when the volcano page appears, you should see the little magnifying glass plus rollover image under the main image to the right. As I said, on these specific pages, in IE 7 the symbol jumps to the top left of the main image.
For your info, I have seen this problem on my older XP pc, which runs IE 7. All is fine on my newer Vista pc, which is using IE8 & Firefox.
Maj -
Strange JScrollPane problem in JApplet
I've got a JApplet which is giving me a strange problem with the scrollbar of a JScrollPane. The JScrollPane is populated with a JList whose ListModel is a DefaultListModel. I specify to always show the vertical and never show the horizonatal scroll bars.
Once the JList content goes beyond the visible range of the viewport, it seems to be working as usual - the scrollbar reflects the amount of content. However, if I click on the scroll arrows, nothing happens. And, if I click on the scroll bar itself, it disables. Basically, the scrolling portion of the component dies. I don't get any exceptions during runtime or problems compiling the code.
I've tried making the ListModel and JList as dynamic elements (i.e. not members of the class). I've tried adding .validate(). I've tried everything of which I can think. I'm at a loss. The most troubling part of this is that if the project is set up as an application instead of an applet, it works fine.
I'm using J2 1.6.
Here's sample code that reproduces the problem:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ScrollTest extends JApplet
private DefaultListModel exOddLM;
private JList exOddJL;
private JScrollPane exOddSP;
private JButton click;
public ScrollTest() {
this.setup();
public void init() {
this.setup();
public void setup() {
this.setLayout(null);
this.setSize(400, 442);
this.exOddLM = new DefaultListModel();
this.exOddJL = new JList(this.exOddLM);
this.exOddSP = new JScrollPane(this.exOddJL);
this.exOddSP.setBounds(0, 0, 200, 200);
this.exOddSP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
this.exOddSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
this.click = new JButton("add more");
this.click.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent me) { addMore(); }
this.click.setBounds(0, 200, 200, 18);
this.add(this.exOddSP);
this.add(this.click);
private void addMore() {
for(int x = 0; x < 5; x++) {
this.exOddLM.addElement(Integer.toString(x));
}It had to be something simple, didn't it? (=
Thanks!
I guess I was thinking that an applet wouldn't call the constructor. Don't know why I would have thought that. After removing the double call, it works great.
Thanks again Rodney!!!
You know, this actually explains a good deal of other problems I was having with the actual program (a homework assignment). One of them, I had added a KeyListener to an entry field on the form, and it was giving me all sorts of weird double-letter posts and letter-delete problems.
This also explains why it was working well as an application. -
JTabbedPane and JScrollPane problem
Hi all,
I'm trying to make working JScrollPane into JTabbedPane. I have been trying several times to make it but with no acceptable effects :( I attached below the simple code to show what I'm interested in.
PANEL1 has its dimension. I'd like to make that the JScrollPane will be active and enabled to roll when user change JFrame size to less than PANEL1 on pane1.
Please help!
Thanks for everyone,
Greetings,
import java.lang.*;
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
public class Sample {
static JFrame fr;
static JPanel pane1, pane2, pane3;
static JLabel AAA, BBB, CCC;
static JPanel PANEL1;
static JTabbedPane panel;
public static void main(String args[]) {
fr = new JFrame("Sample");
pane1 = new JPanel();
pane1.setLayout(null);
pane2 = new JPanel();
pane2.setLayout(null);
pane3 = new JPanel();
pane3.setLayout(null);
panel = new JTabbedPane();
Font myfont1 = new Font("SansSerif",0,20);
Font myfont2 = new Font("SansSerif",0,15);
Font myfont3 = new Font("SensSerif",1,15);
AAA = new JLabel("AAA");
BBB = new JLabel("BBB");
CCC = new JLabel("CCC");
AAA.setFont(myfont2);
BBB.setFont(myfont2);
CCC.setFont(myfont2);
AAA.setBounds(20,20,300,20);
BBB.setBounds(20,50,300,20);
CCC.setBounds(20,80,300,20);
PANEL1 = new JPanel();
PANEL1.setLayout(null);
PANEL1.setBackground(java.awt.Color.CYAN);
PANEL1.setBounds(20,15,250,300);
PANEL1.add(AAA);
PANEL1.add(BBB);
PANEL1.add(CCC);
pane1.add(PANEL1);
panel.insertTab("A", null, pane1, null, 0);
panel.setSelectedIndex(0);
panel.insertTab("B", null, pane2, null, 1);
panel.setSelectedIndex(0);
panel.insertTab("C", null, pane3, null, 2);
panel.setSelectedIndex(0);
panel.setBounds(0,0,550,450);
fr.setLayout(null);
//fr.setResizable(false);
fr.setBackground(java.awt.Color.CYAN);
fr.setForeground(java.awt.Color.CYAN);
fr.add(panel);
fr.pack();
fr.setSize(550, 450);
fr.setLocationRelativeTo(null);
fr.setVisible(true);
}Unfortunately no :( Besides, I can't understand at
all this line:
JTabbedPane (panel)TabbedPane = ... new
w JTabbedPane(...).add/insertTab( ... new
JScrollPane(new JPanel(...)) ... )It's to big cut-off like for me. Can you insert it
into my Sample?
Regards and thanks,It's only my "dev speak". Put a ";" and a var name (, ...) whereever needed, and remove some"()".
(Sorry, normally I don't help dev beginners on so more complex problems, with just an easy answer.) -
Hi
i created a jpanel, painted some 2D-Graphics on it (within the paintComponent-method) but it don't fit on the screen because its too large. So i put the panel in a JScrollPane. But when i drag the Scrollbutton up or down my graphics are fractured very bad. The problem don't exist under wMe. I use sdk1.3.
thanks, hope somebody can help me!Hello trankiemhung,
Thanks for using Apple Support Communities.
I found the following information that will help resolve your issue:
Using Game Center
http://support.apple.com/kb/HT4314
Additional Information
If you are having difficulty logging in to Game Center or staying connected
Verify that you are connected to the Internet.
If you are unable to create or sign in to your Game Center account from within a game, try creating or signing in to your account using the Game Center app.
Try signing out of your Game Center account, then sign back in. If you can't sign in to your Game Center account with an Apple ID, try resetting your password or using another email address. To manage your Apple ID account, go to My Apple ID.
When using a Wi-Fi connection, verify that your Wi-Fi router is configured for Game Center.
Take care,
Alex H. -
Little WiFi problem/projecy
Hi,
I've got a little problem. I have to install a small network in my basement, but my cable modem is on the 2nd floor and i can't move nothing.
On the 2nd floor, i have a WiFi router connected to the modem.
Now i want to connect another WiFi router (maybe configured as a AP) to the WiFi router on the 2nd floor.
Diagram :
(modem) --cable-- (WiFi router 1) << wireless >> (WiFi Router 2) --cable-- (PC)
Is this possible ?
I have a DLink DIR-655 and Linksys WRT54GX2.No. You must connect the two routers via an ethernet cable to do what you want. However, 3rd party firmware can connect them wirelessly, but I don't not know if D-Link can do this. Check for DD-WRT firmware to handle both routers.
-
Hi,
I have a text area and wish to add a JScrollPane into the text area. I dont want to add the text area into the scroll pane in the following manner:
JScrollPane pane = new JScrollPane(textArea);Instead I want to use the default constructor:
JScrollPane pane = new JScrollPane( );and then add in the textarea afterwards. The problem is that I cannot seem to find any method to add the component into the scroll pane.
Please help me by also submitting code.
Thanks in advance
Rizwanpane.setViewportView(textarea);
-
JSplitPane / JScrollPane Problem
Hi,
i use a JSplitPane to divide a navigation-panel (JTree) and a viewer-panel (JEditorPane)
this works fine with only one problem. the JEditorPane used to display the data has no ScollBars. I�ve already added a JScrollPane instead of the JEditorPane directly but that does not seem to work out.
how ever, i think this depends on the fact that the JScrollPane (which contains the JEditorPane) is added as the right part of the JSplitPane.
any ideas how to fix this problem, or how it is caused?
thx anyway
cu ErrraddicatorHi,
i use a JSplitPane to divide a navigation-panel (JTree) and a viewer-panel (JEditorPane)
this works fine with only one problem. the JEditorPane used to display the data has no ScollBars. I�ve already added a JScrollPane instead of the JEditorPane directly but that does not seem to work out.
how ever, i think this depends on the fact that the JScrollPane (which contains the JEditorPane) is added as the right part of the JSplitPane.
any ideas how to fix this problem, or how it is caused?
thx anyway
cu Errraddicator -
HP phoenix 1183 little boot problem
Hi,
I bought an hp phoenix 1183 a few months ago. Now i am experiencing a strange problem for 3-4 days now. When I open my computer, it boots up fast in like 10-15 sec because of the SSD and just after entering the home screen, it freezes for 2-3 min and then it runs like a charm like nothing happenned. It close fast like it was new i just have this little problem when it starts it freeze at the home screen for a few minutes and then works fine. I analyzed my system with antivirus, i got nothing. I installed intel SSD toolbox, my health is 100%, SMART and everything is ok. I never did an update of any driver I use the factory drivers and so far until this I never got that problem. Three weeks ago, i upgraded my ram and I checked everything if its compatible and it worked like a charm, it's same speed 1333mhz ddr3 240 pin Kingston, I checked on the internet to see if it works with this model and I checked the supported RAM on the motherboard before upgrading. I am pretty sure that it is not because of the RAM because it works fine and windows recognize it and everything, and in plus, this problem happened to me a few times before I upgraded my ram (I thought back then that it was only a windows bug). I am also pretty sure that the ram is not deffective because it never failed and I got no hardware errors. So what is it?
Thanks you for your answers
VladHello alexjedicool. I understand you're having some issues with your computer hanging. Also, I like your name!
A good first step will be to run a diagnostic on the RAM just in case. You'll want to create some bootable media to run the MemTest application.
Also, I'd like you to run a check on your computer's system files. Try the following.
Click Start, type "cmd," and press Enter.
Type the "sfc /scannow" command and press Enter.
Allow the process to complete.
Post the results.
Also, what is your computer's product number? This document can show you where it is located.
Have a wonderful day!
Please click the white star under my name to give me Kudos as a way to say "Thanks!"
Click the "Accept as Solution" button if I resolve your issue. -
Little Snitch Problems / Trail software Problems
Hello all, I'm not sure if this is the right place to post this question but it's the best I could find.
I recently downloaded two trial softwares. Little Snitch, and AstoundStereo, both from the Apple site. I decided against using both of them and deleted them before the trail ran out. Problem is, I'm still receiving annoying alerts from both programs, even though no trace of them (that I can see) remains on my computer.
Little Snitch will pop up and tell me my 3 hour trial has expired (it expired a few weeks ago) and AstoundStereo is still counting down the days left in its trial, despite both these applications being uninstalled.
Anybody know how I can fix this problem?
Any help greatly appreciated thank youHi
AstoundStereo - per the developer, run the uninstall program located in the AstoundStereo Expander folder, which is within the Applications folder. If you deleted that folder, download another copy of the software and open the installer. Either you'll be able to uninstall it from there, or you'll need to install the app. again so you can uninstall it.
Little Snitch - uninstall directions here. -
JTabbedPane/JSplitPane/JScrollPane problem
Hi
I'm making a simple webbrowser with the JDesktop (jdic) parser (using your standard browser as parser)...
The problem I have :
I have a "JTabbedPane" containing a "JSpitPane". This JSplitPane contains a "JCombobox" (as URL field) and a "JScrollPane".
The "JScrollPane" contains the jdic WebBrowser...
When I resize the JFrame of my application bigger, everything will resize okay. When I'm making my JFrame smaller, the JScrollPane doesn't resize correctly , so the scrollbars are gone !
I tried already a lot of things like putting the jdic WebBrowser directly in the JSplitPane, using a JPanel instead of the JSplitPane, ...
It only works correctly if I add the jdic Webbrowser directly to the JTabbedPane...
I know it's difficult to understand but I hope somebody can help me !
If you know another solution to add a JCombobox and a jdic Webbrowser together, let me know !"
Thx in advance!
grtz
UnzipHi,
The JPanels which you have inside each tab of the JTabbedPanes should have BorderLayout and the JScrollPanes which hold the JTables should be added with the BorderLayout.CENTER constraint. This will make sure that the JScrollPanes that contain the JTables occupy as much space as possible.
Hope this helps,
Ranga.
Maybe you are looking for
-
An error occurred during submit process. Cannot process content of type
Hi, When i click on the submit button, my pdf is able to call servlet but it shows error while preparing for submit. Why am i getting this error. The form is not getting submitted completly. Please someone provide me solution for this. The servlet ur
-
LSMW uploading excel with different number of columns
Dear Expert, I am trying to build a lsmw to upload data sometime the number of columns are different. For example, a standard excel has 5 columns but sometime it only has 4 columns with the input screen of 4 fields. I am wondering what is the APAB co
-
Does anyone have any advice/scripts for monitoring queue lengths? I'd like to be able to monitor the lengths of the queues within my system, ideally such that once queueing occurs an alert/message of sorts can be raised. So far I have no continously
-
HT5624 I Am not able to open my IPAD - it is asking for a "Pass Code" what is this?
I am not able to open my IPAD - it is asking for a "Pass Code" what is this?
-
Text is missing in Book slideshow/book preview
MacBookAir5,2 iPhoto 11 version 9.4.1 (701.67) Software OS X 10.8.2 (12C60) I created a book in iPhoto a week ago. iPhoto was upgraded in the middle of the book creation process. My book was converted by a new version of iBook to a new format. Now I