Scrollpane/Scrollbar Help
The items in the list are being generated from an XML file.
At the moment, I only have 5 in the list because that's all that
would fit. What I want to do is have a scrollable list in that
area, so that my XML file could list many more than 5 items.
I'm not sure where to begin. I've done searches online, but
they don't seem to be what I'm looking for. What makes it more
complicated is that those items in the list are dynamically created
from a "linkaged" movie clip in the project library.
Any help would be appreciated. Even if it's just a point in
the right direction. Thanks.
Rob - The items in the list are dynamically created movie
clips that contain two dynamic text fields (title, short
description) and a transparent hit area. This isn't going to help,
but thanks for the thought.
At the moment, I'm thinking that I could create the list in a
separate SWF and then "import" it in a scrollpane placed in the
original SWF. This isn't preferable to me, though, because I'd
rather keep it all self-contained. If I'm barking-up the wrong
tree, let me know, please!
Similar Messages
-
Scrollpane scrollbar not reponding to clicks
Hi all,
I'm using the scrollpanesample from the UIControlSamples, however when I click on the scrollbar arrows or between an arrow and the knob, nothing happens. Is there a setting or event I need to define for the scrollpane scrollbar to function as expected?
Thanks in advance
*^* <--- arrow, click here and nothing happens
| | <--- click here and nothing happens
| |
[0] <--- knob, you can click, hold and move using the knobThat is normal.
Press hard the trackpad to register the click.
System Preferences > Trackpad > Point & Click
Enable "Tap to click".
Best. -
hi..
the code below are in working condition.. means can be compiled & run.. when drag the scrollbar, the "Welcome To Java" string message will be move left, right or up, down depend on which scrollbar u drag..
just wanna ask if the "Welcome To Java" text be changed to image?? so instead of the text shifting.. its the image tt is moving.. can anyone help me.. ??
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class ScrollbarDemo extends Applet implements AdjustmentListener
//declare scrollbars
Scrollbar scbHort, scbVert;
//declare a canvas
ScrollMessageCanvas c;
public static void main(String[] args)
ScrollbarDemo f = new ScrollbarDemo();
f.setSize(300,200);
f.setVisible(true);
public ScrollbarDemo()
setLayout(new BorderLayout());
//create scrollbars
scbVert = new Scrollbar();
scbVert.setOrientation(Scrollbar.VERTICAL);
scbHort = new Scrollbar();
scbHort.setOrientation(Scrollbar.HORIZONTAL);
add("Center", c = new ScrollMessageCanvas());
add("East", scbVert);
add("South", scbHort);
//register listener for the scrollbars
scbHort.addAdjustmentListener(this);
scbVert.addAdjustmentListener(this);
public void adjustmentValueChanged(AdjustmentEvent e)
if(e.getSource() == scbHort)
/*getValue() and getMaximumValue() return int, but for better precision, use double*/
double value = scbHort.getValue();
double maximumValue = scbHort.getMaximum();
double newX = (value*c.getSize().width/maximumValue);
c.setX((int)newX);
else if(e.getSource() == scbVert)
/*getValue() and getMaximumValue() return int, but for better precision, use double*/
double value = scbVert.getValue();
double maximumValue = scbVert.getMaximum();
double newY = (value*c.getSize().height/maximumValue);
c.setY((int)newY);
class ScrollMessageCanvas extends Canvas
private int x = 10;
private int y = 20;
private String message = "Welcome to Java!";
public ScrollMessageCanvas()
repaint();
public void setX(int x)
this.x = x;
repaint();
public void setY(int y)
this.y = y;
repaint();
public void paint(Graphics g)
g.drawString(message, x, y);
}what should i replace this line with??
[[ private String message = "Welcome to Java!"; ]]
public void paint(Graphics g)
g.drawString(message, x, y);
can be replaced by
public void paint(Graphics g)
g.drawImage(image, 0,0);
} -
Hello.
I am trying to build a webpage with a fixed sized window in
the centre of the page. Within this window I would like to display
some photos I have taken. What I would like to happen is for people
to be able to scroll right to view my pictures, but for the main
navigation not to disapear. So I thought I could incorporate a
horazontal scrollbar into the central box, so that whatever content
is in the box is scrollable. I have noticed things called div tags
and I think that this is the way forward, although I don't seem to
be able to use these effectivly.
Can anybody help me please.
Thanks
SThe scrollbar works, you can try using a simple JComponent with a set preferred size instead of the JTextPane and it will work. The problem is that the JTextPane always wraps its lines, so it doesn't need to be wider - therefore the scrollbar doesn't appear (or doesn't display the knob in case it's always displayed). You'll have to find a way to somehow disable line wrapping in that JTextPane, or you'll have to use another component to display your data, for example JTable.
-
Hello! Does anyone know any decent AS2 custom scrollbar tutorials? I'm looking to create a basic scrollbar that has a white up arrow and a white down arrow, but none of the tutorials I've tried end up working properly..... I've done way more complex stuff without any issues, so I don't know why I'm having so much trouble with scrollbars. Any help or suggestions would be much appreciated!
Thank you,
NicoleThanks! unfortunately you have to shell out $20 to view the tutorial found on that web page, but I did find another one that worked after I played around with it for a very, very long time. I'll post it incase anyone else would find it useful:
http://www.kirupa.com/developer/flash8/scrollbar.htm
After I altered the colors, content, and sizing, I saved the scroll area as it's own .swf. I then loaded it as an external movie clip into another page on my Flash site and it worked perfectly! -
Scrollbar Help Appreciated!
Hello everyone, this is my first post and was hoping for some
advice.
I am fairly new to Flash, I have no idea about Actionscript,
a part from stop();
I have designed a button that when you put your mouse over,
it slides out using a motion tween to reveal a panel with thumbnail
pictures. However, I need to make the panel scroll downwards to fit
all of the pictures on. When I click on the pictures, I want it to
take me to the relevant frame.
Please could someone point me in the right direction as to
how I could do this, links anything!
Many thanks,
HelenYou could try to put the two trees into a ScrolledComposite.
This way they should always have enough space available and probably
won't display their own scrollbar.
See the SWT teams Snippets page for an exmaple how to use ScrolledComposite.
Yves
exquisitus wrote:
> Hi - I have 2 trees side by side in a composite. I want both to use only
> the composite (vertical) scrollbar as oppose to each using their own.
> I've tried setVisible(false) but as soon as a resizing takes place the
> scrollbar appears plus this does not force it to use its parent. Is
> there a way of forcing a Tree Widget to use its Parent scrollBar. Any
> help appreciated.
> -
How To make a custom ScrollPane/scroller Help.
I want to make a MC that holds various Data such as textfields images maybe a video, ect just basic content, so i want to put that into a MC and be able to scroll it. But i cant figure out how to do this, no tutorials on the internet. And i dont want to use the UIScroller and Scrollpane components as they are highly unnatractive.. It is for a touch enabled device so maybe a gesture could be used? But im sure a Mouse Event would work, Can some one help me out or point me in the right direction?
Thanks in advance.Your best bet for finding tutorials is Google. Here's one result for a search using "AS3 movieclip scroller" that shows the basics.
http://tutorials.flashmymind.com/2009/02/movieclip-scroller/ -
[F8/AS2] ScrollPane scrollbars not showing in IE. WHYYYYY!!
Argh! ScrollPane is a Pain! Been working on this for 2 weeks!
HELP!!
In a container movie, I have loaded an swf that contains a
scrollPane which in turn loads an external swf.
In Firefox, it works like a charm. In IE, the scroll bars do
not appear!
Here is the code I am using in the swf that contains the
scrollPane:
var scrollContent:mx.containers.ScrollPane;
scrollContent.contentPath ="ABSOLUTE_LINK_TO_MY.SWF";
scrollContent.setStyle("themeColor","haloBlue");
scrollContent.setSize(248,375);
scrollContent.border_mc._height = 0;
scrollContent.border_mc._width = 0;
scrollContent.hScrollPolicy="auto";
scrollContent.vScrollPolicy="auto";
scrollContent.refreshPane();
The live example is here. Click on Programs then Purple Scarf
Project:
http://www.becausecuidamos.com/newsite/index.htm
On the Internet, I've seen tons of posts about this problem.
But no matter where I look, no one posts a solution. Can anyone
here help? PLEASE!!!!
Thank youArgh! ScrollPane is a Pain! Been working on this for 2 weeks!
HELP!!
In a container movie, I have loaded an swf that contains a
scrollPane which in turn loads an external swf.
In Firefox, it works like a charm. In IE, the scroll bars do
not appear!
Here is the code I am using in the swf that contains the
scrollPane:
var scrollContent:mx.containers.ScrollPane;
scrollContent.contentPath ="ABSOLUTE_LINK_TO_MY.SWF";
scrollContent.setStyle("themeColor","haloBlue");
scrollContent.setSize(248,375);
scrollContent.border_mc._height = 0;
scrollContent.border_mc._width = 0;
scrollContent.hScrollPolicy="auto";
scrollContent.vScrollPolicy="auto";
scrollContent.refreshPane();
The live example is here. Click on Programs then Purple Scarf
Project:
http://www.becausecuidamos.com/newsite/index.htm
On the Internet, I've seen tons of posts about this problem.
But no matter where I look, no one posts a solution. Can anyone
here help? PLEASE!!!!
Thank you -
Web pages are missing their default scrollbars - help
Web pages are missing their scroll bars.
To be clear — I can create scroll bars for any element
within a page — no problem.
It’s that each pg itself which by default should come with its own scrollbars has none.
So if a viewer can’t see the entire page the viewer has no means to
horizontally or vertically scroll to see the off-screen portion of the page.
I’ve talk to the adobe tech support about the scroll-less pages.
They said the problem is beyond their expertise and lies in the code itself.
They advised me to reach across this platform for the answer.
The problem is consistent on all browsers.
I ran the pages thru Dreamweaver’s browsers’ lab. Pages varied slightly with each
Browsers, on the whole looked good. BUT a portion of the image on the right side
was cut off and the scrollbars were not available on the Adobe Browsers Test Lab page.
No errors were found when run thru Dreamweaver’s Browser Compatibility.
I reviewed the code but I have no idea what I’m looking for.
See For Yourself, the website with no scrollbars: voicesforthearts.com
Howard Blume
[email protected]
max os x system10.6.6
Dreamweaver 5While you are at it Howard, I noticed a METATAG in your BODY section.... it's already in the HEAD section.
<div id="logonavbar">
<ul>
<li><meta name="description" content="" /> -
ScrollBar HELP Needed!!!
Hello,
I am developing a swing front end, however the size of the screen has grown quite large and at low resolutions I cant see some areas of the JFrame.
I need to be able to add a JScrollBar to the JFrame so that I will be able to scroll down to the parts of the screen which dissapear off the monitor.
Can anyone tell me how to do this??? I REALLY am stuck here! Thanks in advance.1. Post swing questinos in the Swing area.
2. Add the scrollpane to the frame the other way around.
import java.awt.*;
import javax.swing.*;
public class ScrollPaneDemo extends JFrame
public ScrollPaneDemo()
super( "Scroll Demo");
setDefaultCloseOperation( EXIT_ON_CLOSE );
JPanel panel = new JPanel( new GridLayout( 20, 20 ) );
for( int i = 0; i < 400; i++ )
JLabel label = new JLabel( "Row = "+ i/20 +" col = "+i%20 );
label.setBorder( BorderFactory.createLineBorder( Color.black ) );
panel.add( label);
setContentPane( new JScrollPane( panel ) );
setSize( 200, 200 );
setLocationRelativeTo( null );
setVisible( true );
public static void main( String[] args )
new ScrollPaneDemo();
} -
Change color of scrollpane (scrollbar)
Well i've been trying to figure out how todo this, but i failed
doing scrollPane.setBackgroundColor or foreground doesn't work
any ideas if it is even possible??
Thanks in advance!The following code will probably show the cause of your problem, the opacity of the view.
import java.awt.Color;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuBar;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
public class BackgroundOnScrollPane {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JFrame frame = new JFrame("Test back ground");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JLabel content = new JLabel(
"This is the content of the scroll pane", JLabel.CENTER);
content.setOpaque(true);
JScrollPane scrollPane = new JScrollPane(content);
scrollPane.getViewport().setBackground(Color.PINK);
frame.add(scrollPane);
frame.setJMenuBar(new JMenuBar());
frame.getJMenuBar().add(
new JCheckBoxMenuItem(new AbstractAction(
"Content opaque") {
private static final long serialVersionUID = 1L;
this.putValue(Action.SELECTED_KEY, content
.isOpaque());
@Override
public void actionPerformed(ActionEvent e) {
content.setOpaque((Boolean) this
.getValue(Action.SELECTED_KEY));
content.repaint();
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}Piet -
Controlling multiple TextAreas with one ScrollBar
Hello,
Fairly new to java so you may have to excuse my lack of java knowledge!
I would like to create a Frame with three TextAreas, side-by-side, controlled by a single ScrollBar.
I thought it would be fairly easy. Just add the three TextAreas to a Panel then add a ScrollPane to the Panel. If that is the right way, how can you make the TextArea as high as the number of rows. Think I've seen some example using Swing but I'm using AWT.
I've provided some example code if it helps:
import java.awt.*;
public class MyExample extends Frame
TextArea field1 = new TextArea("", 0, 0, TextArea.SCROLLBARS_NONE);
TextArea field2 = new TextArea("", 0, 0, TextArea.SCROLLBARS_NONE);
TextArea field3 = new TextArea("", 0, 0, TextArea.SCROLLBARS_NONE);
MyExample()
super("My Example");
this.setSize(800, 500);
new BorderLayout();
//enter any data into all three text areas
for (int i = 0; i < 150; i++)
field1.append(i+"\n");
field2.append(i+"\n");
field3.append(i+"\n");
/** Any method here to make the TextAreas the maximum height (so the TextAreas
* are too large for the Panel and need the scrollbar!). I have tried setSize,
* setMinimumSize, setMaximumSize, setRows and prob more but cannot get any
* to work!?!
// create panel and add the three text areas
Panel centerPanel = new Panel(new GridLayout(1,3));
centerPanel.add(field1);
centerPanel.add(field2);
centerPanel.add(field3);
//create a scroll pane and add the panel to control
ScrollPane scrollPane = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
scrollPane.add(centerPanel);
// add scroll pane to frame
add("Center", scrollPane);
}Any help is appreciated!
DaveHai dave,
try the below program in which i set the panel size by calculating the textarea size. To caluculate the number of lines in the text area-field1:
1. store the value of field1 in a string
2. find the number of '\n' -end line characters
this gives the number of lines in the text area-field1
then set the height of the panel equivalent to the height of field1 by using the calculated number of lines * 15( a single line takes 15"-i am not certain but it is OK).
import java.awt.*;
public class MyExample extends Frame
TextArea field1 = new TextArea("", 0, 0, TextArea.SCROLLBARS_NONE);
TextArea field2 = new TextArea("", 0, 0, TextArea.SCROLLBARS_NONE);
TextArea field3 = new TextArea("", 0, 0, TextArea.SCROLLBARS_NONE);
public MyExample()
super("My Example");
this.setSize(800, 500);
new BorderLayout();
//enter any data into all three text areas
for (int i = 0; i < 300; i++)
field1.append(i+"\n");
field2.append(i+"\n");
field3.append(i+"\n");
/** Any method here to make the TextAreas the maximum height (so the TextAreas
* are too large for the Panel and need the scrollbar!). I have tried setSize,
* setMinimumSize, setMaximumSize, setRows and prob more but cannot get any
* to work!?!
**/int k=0;
String str=field1.getText();
/*my for loop to calculate number of lines in the string which holds value of TextArea-field1*/
for(int j=0;j<str.length();j++){
if(str.charAt(j)=='\n')k++;
System.out.println(String.valueOf(k));
Panel centerPanel = new Panel(new GridLayout(1,3));
centerPanel.add(field1);
centerPanel.add(field2);
centerPanel.add(field3);
Dimension dim=field1.getPreferredSize();
ScrollPane scrollPane = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
scrollPane.add(centerPanel);
//the scroll bar of mouse can't work!(?)
centerPanel.setPreferredSize(new Dimension(780,k*15));
add("Center", scrollPane);
setVisible(true);
public static void main(String args[]){
new MyExample();
* if you still have problem then post but expects my reply after atleast 2 days:i am busy -
Scrollpane all screwy inside loaded swf
I have had this problem using both the scrollPane component
from Flash 8 and an open source code scrollpane that I found in
Flashkit. I have an swf in which I'm using a scrollPane which works
fine when I test the movie. However, I'm loading this swf into
another master swf using loadMovie. When I do this, the scrollpane
inside the loaded swf gets really buggy. First, the scrollbar will
not stop scrolling when I release the mouse. Also, the whole
scrollPane gets a green highlight around the edges (except in the
open-source code scrollpane). HELP!! Does anyone know how to load a
scrollPane into another swf without it getting all weird?//below is the code for the "slideshow.swf"
//For the main movie.. I'm doing....
button_btn.onRelease = function() {
myMovieClipLoader_mc.loadMovie("slideshow.swf")//
this.createEmptyMovieClip("container_mc",this.getNextHighestDepth());
this.createEmptyMovieClip("buttons_mc",this.getNextHighestDepth());
//loader//
this.attachMovie("loader2","loader_mc",this.getNextHighestDepth());
loader_mc._x = (Stage.width - loader_mc.width)/2;
loader_mc._y = (Stage.height - loader_mc.height)/2;
var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myMCL.addListener(myListener);
myListener.onLoadProgress =
function(target,bytesLoaded,bytesTotal) {
loader_mc._alpha = 100;
var pct = Math.round(bytesLoaded/bytesTotal*100);
loader_mc.bar_mc._xscale = pct
myListener.onLoadComplete = function(target) {
loader_mc._alpha = 0;
//button movies//
buttons_mc.attachMovie("prev","prev_mc",buttons_mc.getNextHighestDepth());
buttons_mc.attachMovie("next","next_mc",buttons_mc.getNextHighestDepth());
buttons_mc.next_mc._x = Stage.width -
buttons_mc.next_mc._width;
buttons_mc.next_mc._y = 10;
buttons_mc.prev_mc._x = 10;
buttons_mc.prev_mc._y = 10;
//variables//
var numPics:Number = 5
var picArray:Array = new Array();
var currentElement:Number = 0;
for (i=0;i< numPics;i++) {
var location:String = "pics/pic0" + (i+1) + ".jpg";
picArray.push(location);
myMCL.loadClip(picArray[currentElement],container_mc);
//next button//
buttons_mc.next_mc.onRelease = function() {
if (currentElement < picArray.length-1) {
currentElement++;
else
currentElement = 0;
myMCL.loadClip(picArray[currentElement],container_mc);
//prev button//
buttons_mc.prev_mc.onRelease = function() {
if (currentElement > 0) {
currentElement--;
else
currentElement = picArray.length-1;
myMCL.loadClip(picArray[currentElement],container_mc);
} -
Activate scrollPane Scrollbbars at runtime
Hello,
I'm having an issue here trying to make scrollPane scrollbars to apear and work
I'm creating one scrollPane at runtime with
var sp_veiculos:ScrollPane = new ScrollPane();
sp_veiculos.name = "sp_veiculos";
addChild(sp_veiculos);
then I want to have an if statmento to make the scrollbars apear if I need like
if (numero_veiculos < 3) {
sp_veiculos.verticalScrollPolicy = "OFF";
sp_veiculos.horizontalScrollPolicy = "OFF";
} else {
sp_veiculos.verticalScrollPolicy = "ON";
sp_veiculos.horizontalScrollPolicy = "OFF";
this does not work...
Any help please?
Thanks
PludaRefplace following piece of code and it should work.
import fl.controls.*;
var numero_veiculos = 4;
if (numero_veiculos < 3)
sp_veiculos.verticalScrollPolicy = ScrollPolicy.OFF;
sp_veiculos.horizontalScrollPolicy = ScrollPolicy.OFF;
else
sp_veiculos.verticalScrollPolicy = ScrollPolicy.ON;
sp_veiculos.horizontalScrollPolicy = ScrollPolicy.OFF;
sp_veiculos.refreshPane(); -
Is there a way to adjust the thickness of a WebView's scrollbars?
Hello,
Is there a way to adjust the thickness of a WebView's scrollbars?
I tried the solutions mentioned here ScrollPane scrollbar size
But they don't seem to work for WebView scrollbars.
Thanks.NO
Maybe you are looking for
-
Ipod classic 80 freezes itunes and won't work
upgraded itunes to 10.1 (etc). plugged in formerly operating ipod classic 80. it showed up in the device list,. but i could not move the cursor off music. had to use ctrl-alt-delete to close itunes. ipod would not disconnect. tried to disconnectg by
-
I show 3 versions of PS installed: PS CC, PS CC (64 bit) and PS CC (2014). Can I just delete the 1st 2 and only keep the latest?
-
Where can I get a new battery for my Macbook?
I have a macbook purchased in 2007. The battery will not charge. works great in 120v. where can I get a new battery?
-
How do I update my Itunes to the new 11.1?
I need to back up my iphone onto my computer but i need to update itunes to the new 11.1 but it is not working.
-
Hi, We have to projects to implement. One is upgradation to 10g from 9i and the other one is partitioning 13 of our major tables. We have already partitioned 4 of them. Will it be safer to complete patitioning before moving over to 10g? What are the