Scroll Bar Help
I've attached the code that I created for using a scroll bar.. When you click to scroll and go back up to the top it doesn't go all the way up to the top..It goes a few lines down still. How can I adjust this to be correct?
import caurina.transitions.*;
laminatetxt_mc.mask = scrollmask_mc
var yOffset:Number;
var yMin:Number = 0;
var yMax:Number = scrollbar_mc.track_mc.height - scrollbar_mc.handle_mc.height;
scrollbar_mc.handle_mc.addEventListener(MouseEvent.MOUSE_DOWN, handleDown);
stage.addEventListener(MouseEvent.MOUSE_UP, handleUp);
function handleDown(e:MouseEvent):void
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleMove);
yOffset = mouseY - scrollbar_mc.handle_mc.y;
function handleUp(e:MouseEvent):void
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleMove);
function handleMove(e:MouseEvent):void
scrollbar_mc.handle_mc.y = mouseY - yOffset;
if(scrollbar_mc.handle_mc.y <= yMin)
scrollbar_mc.handle_mc.y = yMin;
if(scrollbar_mc.handle_mc.y >= yMax)
scrollbar_mc.handle_mc.y = yMax;
var scrollpercent:Number = scrollbar_mc.handle_mc.y / yMax;
Tweener.addTween(laminatetxt_mc, {y:(-scrollpercent*(laminatetxt_mc.height-scrollmask_mc.height)), time:1});
e.updateAfterEvent();
import caurina.transitions.*;
laminatetxt_mc.mask = scrollmask_mc
var yOffset:Number;
var yMin:Number = 0; // set minimum handle_mc y
var yMax:Number = scrollbar_mc.track_mc.height - scrollbar_mc.handle_mc.height; // set max handle_mc.y
scrollbar_mc.handle_mc.addEventListener(MouseEvent.MOUSE_DOWN, handleDown);
stage.addEventListener(MouseEvent.MOUSE_UP, handleUp);
function handleDown(e:MouseEvent):void
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleMove);
yOffset = mouseY - scrollbar_mc.handle_mc.y;
function handleUp(e:MouseEvent):void
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleMove);
function handleMove(e:MouseEvent):void
scrollbar_mc.handle_mc.y = mouseY - yOffset;
if(scrollbar_mc.handle_mc.y <= yMin)
scrollbar_mc.handle_mc.y = yMin;
if(scrollbar_mc.handle_mc.y >= yMax)
scrollbar_mc.handle_mc.y = yMax;
var n:Number = scrollbar_mc.m*scrollbar_mc.handle_mc.y+scrollbar_mc.b;
Tweener.addTween(laminatetxt_mc, {y:n, time:1});
e.updateAfterEvent();
// the following assigns the parameters needed to scroll correctly.
paramF(scrollbar_mc,yMin,scrollmask_mc.y,yMax,scrollmask_mc.y-laminatetxt_mc.hei ght+scrollmask_mc.height);
function paramF(mc:MovieClip,x1:Number,y1:Number,x2:Number,y2:Number):void{
mc.m = (y1-y2)/(x1-x2);
mc.b = y1 - mc.m*x1;
Similar Messages
-
Hello anyone,
I am fairly new to flash, I am using the MX version. I am
having trouble getting my scroll bars to load with the page load?
The bar shows up, but it does not give the option to scroll. If I
click off the page and return to it then the slider is there and it
works, but not on initial load. I have tried to set the action
script run on load but this has not worked. I am a little confused
and any help would be greatly appriciated.
Also as an aside issue, can you load images into a text
box?am I on the right board for this type of question? I am not
very knowledgable in action scripts, but I have been trough the
tutorials and I bought the action scripts for dummies book, however
I have done everything that they say to do and still can't get the
bars to work right.
any help or redirection for help somewhere else would be
greatly appriciated. -
Hello,
I am making a website in flash and need some help with the
actionscript,
Firstly I have coded the drop down menu, its a little buggy
but the main problem with it is the buttons will only work if its a
get URL command rather than go to and stop.
Secondly, I need some help coding the scroll bar if someone
wouldn't mind offering a bit of help with that. I have just under 4
days to get this finished, it’s for my final major project in
college, and would you believe it our technician broke FLASH so I
can't get help form my tutors.
If some one could help I would be extremely grateful, thanks.
Oh and here is a link to the flash file so you can have a
look at the coding.
http://www.breeze-studios.com/breezeflash.fla
Also here is the publish bit so far so you can see what im
going on about.
http://www.breeze-studios.com/breezeflash.swfhi
JPanel jp = new JPanel();
JScrollPanel jsp = new JScrollPanel(jp);
getContentPane.add(jsp); -
Scroll bar :help for a newbie
Hello, I need some help to introduce scroll bar into my programs;
For example I have a JPanel in which I have to introduce a scroll bar when it's needed.
Can you help me please?hi
JPanel jp = new JPanel();
JScrollPanel jsp = new JScrollPanel(jp);
getContentPane.add(jsp); -
Issue with Multithreading and vertical scroll bar - help needed to debug!!!
I have been working on a desktop Visual Studio 2010 application for quite a few years. It is written in C++ and MFC. This code is a combination of code I have written and code I inherited. It worked great for years on Windows XP, but when I ported
it to Windows 7, a tricky problem has come up that I am having the darnest time trying to figure out
In summary, it is a single .exe desktop application. There is the main thread (thread A), which launches another thread (thread B). Both threads share a pointer to a single window object which displays events. This window also implements a vertical and horizontal
scroll bar.
The interaction and message processing between the threads seems a little sticky to me. Both threads A and B call the same member function of the CWnd object. BUT, Thread B ALSO posts messages to thread A's queue.
So, in thread B, you will see code like this, which makes a direct call to the output window object, AND THEN it also posts a message to Thread A's mainframe window like this...
if( m_pEventLog )
pOutputWindow->AddLine("Some test...");
if( m_phNotifyWnd[RECEIVE] && m_puiEventWMsg[RECEIVE] ) {
::PostMessage( m_phNotifyWnd[RECEIVE], m_puiEventWMsg[RECEIVE], 0, (LPARAM) pPkt );
WHEN thread A receives the message that thread B posted above, it only does the following:
LRESULT CMainFrame::OnSocketReceive( WPARAM, LPARAM lParam )
CSPkt* pPkt;
CRWPkt* pRWPkt;
CSPktSocket* pSocket;
ULONG ulType;
CString csTemp;
CBSWords bsWords;
CSSSWords sssWords;
CRWPkt* pLoopBackRWMsg; // used if we have to send a loopback msg back to sender
CLMsg lmsg;
m_wndTextWindow.AddLine("Test message");
return 0;
So both threads are writing to the output window via the .AddLine() member function.
void COutputWnd::AddLine( CString& strLine, COLORREF crColor )
UpdateVScroll();
return;
And this function then makes a call to :UpdateVScroll(). The problem seems to arise because thread B does a
post to thread A, where thread A in turn writes to the output window. Eventually, the program
HANGS in the call to
SetScrollInfo() below...
void COutputWnd::UpdateVScroll()
CSingleLock lock( &m_CSVertScrollLock ); // lock things up while we are in here
BOOL bok = lock.Lock();
if (lock.IsLocked() == TRUE)
int iMax = m_FifoIndices.GetHighestIndex();
if( iMax < ( m_iMaxViewableLines - 1 ) )
iMax = 0;
//SetScrollRange( SB_VERT, 0, iMax, FALSE );
//SetScrollRange( SB_VERT, 0, 9, FALSE );
SCROLLINFO scrollinfo;
scrollinfo.cbSize = sizeof(SCROLLINFO);
scrollinfo.fMask = SIF_RANGE;
scrollinfo.nMin=0;
scrollinfo.nMax= iMax;
SetScrollInfo(SB_VERT, &scrollinfo, FALSE);
lock.Unlock();
It doesn't take long for the program to hang...maybe about 10 seconds.
When I hit DEBUG->BREAK ALL, I get the output below in the CALL STACK WINDOW.
ntdll.dll!770070f4()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
user32.dll!76c0cde0()
user32.dll!76c018d9()
>
mfc100d.dll!AfxInternalPumpMessage() Line 153 + 0x13 bytes
C++
mfc100d.dll!CWinThread::PumpMessage() Line 900
C++
mfc100d.dll!CWinThread::Run() Line 629 + 0xd bytes
C++
mfc100d.dll!_AfxThreadEntry(void * pParam=0x0022f6a4) Line 122 + 0x13 bytes
C++
msvcr100d.dll!_callthreadstartex() Line 314 + 0xf bytes
C
msvcr100d.dll!_threadstartex(void * ptd=0x004f97c0) Line 297
C
kernel32.dll!762cee1c()
ntdll.dll!770237eb()
ntdll.dll!770237be()
NOTE: If I never make the call to SetScrollInfo(), the program never HANGS.
Sooo....I am trying to determine if there is a fundamental issue with the way the threads are communicating that is causing the issue, or if maybe I have a memory overwrite. It always hangs in ::SetScrollInfo(), no matter what I comment and uncomment. This
makes me think that scroll bat behavior is different in Windows 7 than on XP, but I have not been able to find any documentation about it.
Can anyone provide any insight as to what may be the cause of the program hanging>It might look like working but it will crash eventually. The windows are thread affine and other thread must never touch other threads windows. Sometimes you might get along but usually it just crashes.
Thread B must use PostMessage ( or SendMessage if suncronous action is require) to thread A's windows to achieve correct updating. Some very basic calls are implemented directly with SendMessage so they are safe to use but then you must individually check
which ones are safe.
Also having multiple SendMessage calls from B to A require rendezvous which might cause other problems ( thread B stalls or program deadlocks, depending on other program structure).
So PostMessage is the way to do it ( or create yourself another inter-thread mechanism, possible but usually too much troble) -
Swing (JScrollPane - scroll bar) help
Hello all..
I am new user in Swing. Currently I am developing a program using JSCrollPane. I have to draw a kind of chart in it. Therefore as a drawing media, I used the JPanel, in which I put it inside my JScrollPane. Then.. since my graphic is long.. then I set the
setHorizontalScrollBarPolicy value to ALWAYS. Then I put my JPanel using the following commands :
this.jScrollPane1.setViewportView(this.jPanel2);
this.jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
Fyi, my JPanel size is set to be wider than the jScrollPane3 size. Nevertheless.. during the run time the horizontal scroll bar is not shown. I am completely loss on how to solve this. Does anyone has any clue or solution for this problem. Thank you very much in advance.
Kariyage.Fyi, my JPanel size is set to be wider than the jScrollPane3 sizeYou should use panel.setPreferredSize(...) not panel.setSize(...);
-
The status bar is pushed up at about 3/4 of the screen, so I can view only Firefox at about 1/4, good thing there is a scroll bar, but below the status bar is white display? can u please help me, I want to drag down the status bar so I can have a full view
== This happened ==
Every time Firefox openedYour code is absolutely unreadable - even if someone was willing to
help, it's simply impossible. I do give you a few tips, though: If you
understand your code (i.e. if it really is YOUR code), you should be
able to realize that your minimum and maximum never get set (thus they
are both 0) and your exam 3 is set with the wrong value. SEE where
those should get set and figure out why they're not. Chances are you
are doing something to them that makes one 'if' fail or you just
erroneously assign a wrong variable! -
Scroll bar problems ..Please help!!!!!!
This is what the program looks like. topPanel has newItemPanel on top of it. when you click continue newItemPanel becomes invisible and newItemDescriptionPanel becomes visible. When you click continue newItemDescriptionPanel becomes invisible and priceEnterPanel becomes visible.
I want newItemDescriptionPanel and priceEnterPanel to have a scroll bar. but everything I have tried hasn't worked. I am new. You will see the code is ugly and there is an attempt to add a scrollbar.
Please help
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import java.lang.System;
public class MainPanel extends JFrame implements ActionListener
private boolean firstRun = true;
private final int ITEM_PLAIN = 0; // Item types
private final int ITEM_CHECK = 1;
private final int ITEM_RADIO = 2;
private JPanel topPanel;
private JPanel newItemPanel;
private JRadioButton onlineAuctionRadio;
private JRadioButton fixedPriceRadio;
private ButtonGroup bg;
private JButton continueButton;
private JLabel blankLabel; //used to give space between things
private JPanel newItemDescriptionPanel;
private JPanel takeAdditionalSpacePanelCheckBox;
private JPanel takeAdditionalSpacePanel;
private JPanel takeAdditionalSpacePanelLabel;
private JPanel takeAdditionalSpacePanelLabel2;
private JPanel takeAdditionalSpacePanel2;
private JPanel takeAdditionalSpacePanel3;
private JPanel takeAdditionalSpacePanel4;
private JPanel takeAdditionalSpacePanel5;
JScrollPane displayScroller;
JEditorPane itemDescriptionTextArea;
GridBagLayout gridbag;
GridBagConstraints gbc;
private JCheckBox secondCategoryCheckBox;
private JLabel itemTitleLabel;
private JLabel requiredLabel, requiredLabel2;
private JLabel requiredStarLabel;
private JTextField itemTitleTextField;
private JLabel subtitleLabel;
private JTextField subtitleTextField;
private JLabel itemDescriptionLabel;
private JButton itemDescriptionContinueButton;
private JLabel percentageLabel;
//------- price enter page ----------------
private JLabel startingPriceLabel;
private JLabel dollarSignLabel;
private JTextField startingPriceTextField;
private JPanel fillUpSpacePanel;
private JPanel fillUpSpacePanel1;
private JPanel fillUpSpacePanel2;
private JLabel buyItNowLabel;
private JPanel fillUpSpacePanel3;
private JLabel dollarSignLabel2;
private JTextField buyItNowTextField;
private JPanel fillUpSpacePanel4;
private JPanel fillUpSpacePanel5;
private JPanel fillUpSpacePanel6;
private JPanel fillUpSpacePanel7;
private JPanel fillUpSpacePanel8;
private JPanel fillUpSpacePanel9;
private JPanel fillUpSpacePanel10;
private JPanel fillUpSpacePanel11;
private JPanel fillUpSpacePanel12;
private JPanel fillUpSpacePanel13;
private JPanel fillUpSpacePanel14;
private JPanel fillUpSpacePanel15;
private JPanel fillUpSpacePanel16;
private JPanel fillUpSpacePanel17;
private JPanel fillUpSpacePanel18;
private JLabel donatePercentageLabel;
private JTextField donatePercentageTextField;
private JPanel fSp; // fill space panel
private JPanel fSp1;
private JPanel fSp2;
private JPanel fSp3;
private JPanel fSp4;
private JPanel fSp5;
private JPanel fSp6;
private JPanel fSp7;
private JPanel fSp8;
private JPanel fSp9;
private JLabel numberOfPicturesLabel;
private JTextField numberOfPicturesTextField;
private JCheckBox superSizePicturesCheckBox;
private JLabel superSizePicturesLabel;
private JRadioButton standardPictureRadioButton;
private JRadioButton picturePackRadioButton;
private JCheckBox listingDesignerCheckBox;
private ButtonGroup bgPictures;
private JCheckBox valuePackCheckBox;
private JCheckBox galleryPictureCheckBox;
private JCheckBox subtitleCheckBox;
private JCheckBox boldCheckBox;
private JCheckBox borderCheckBox;
private JCheckBox highlightCheckBox;
private JCheckBox featuredPlusCheckBox;
private JCheckBox galleryFeaturedCheckBox;
private JLabel homePageFeaturedLabel;
private JComboBox homePageFeaturedComboBox;
private JCheckBox giftCheckBox;
JScrollPane priceEnterPanelScroll;
private JButton backToRadioButton;
private JButton backToItemDescriptionButton;
private JPanel priceEnterPanel;
private final static String RADIOPANEL = "JPanel with radios";
private final static String DESCRIPTIONPANEL = "JPanel with description";
private final static String PRICEENTERPANEL = "JPanel with price entering";
private JPanel cards;
private JMenuBar menuBar;
private JMenu menuFile;
private JMenu menuEdit;
private JMenu menuProperty;
private JMenuItem menuPropertySystem;
private JMenuItem menuPropertyEditor;
private JMenuItem menuPropertyDisplay;
private JMenu menuFileNew;
private JMenuItem menuFileNewAccount;
private JMenuItem menuFileNewItem;
private JMenuItem menuFileOpen;
private JMenuItem menuFileSave;
private JMenuItem menuFileSaveAs;
private JMenuItem menuFileExit;
private JMenuItem menuEditCopy;
private JMenuItem menuEditCut;
private JMenuItem menuEditPaste;
public MainPanel()
requiredLabel = new JLabel ("* Required");
requiredLabel.setForeground (Color.red);
requiredLabel2 = new JLabel ("* Required");
requiredLabel2.setForeground (Color.red);
requiredStarLabel = new JLabel ("*");
requiredStarLabel.setForeground (Color.green);
setTitle( "photo galleries" );
setSize( 310, 130 );
topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
topPanel.setBorder (BorderFactory.createTitledBorder ("TopPanel"));
//topPanel.setPreferredSize(new Dimension (300,300));
getContentPane().add( topPanel );
topPanel.setVisible (false);
// For New Item Panel
ButtonListener ears = new ButtonListener();
blankLabel = new JLabel (" "); // used to give space between radio buttons and continue button
continueButton = new JButton ("Continue >");
continueButton.addActionListener (ears);
backToRadioButton = new JButton ("< back");
backToRadioButton.addActionListener (ears);
itemDescriptionContinueButton = new JButton ("Continue >");
itemDescriptionContinueButton.addActionListener (ears);
backToItemDescriptionButton = new JButton ("< back");
backToItemDescriptionButton.addActionListener (ears);
newItemPanel = new JPanel();
newItemPanel.setLayout (new BoxLayout(newItemPanel, BoxLayout.Y_AXIS));
//topPanel.add (newItemPanel, BorderLayout.NORTH);
newItemPanel.setBorder (BorderFactory.createTitledBorder ("NewItemPanel"));
newItemPanel.setVisible (false);
onlineAuctionRadio = new JRadioButton ("Sold item at online Auction" );
fixedPriceRadio = new JRadioButton ("Sold at a Fixed Price");
bg = new ButtonGroup();
bg.add(onlineAuctionRadio);
bg.add(fixedPriceRadio);
onlineAuctionRadio.addActionListener (ears);
fixedPriceRadio.addActionListener (ears);
newItemPanel.add (onlineAuctionRadio);
newItemPanel.add (fixedPriceRadio);
newItemPanel.add (blankLabel);
newItemPanel.add (continueButton);
// ------ After continue pressed ---------
newItemDescriptionPanel = new JPanel();
newItemDescriptionPanel.setLayout (new BoxLayout(newItemDescriptionPanel, BoxLayout.Y_AXIS));
newItemPanel.add (newItemDescriptionPanel, BorderLayout.NORTH);
newItemDescriptionPanel.setBorder (BorderFactory.createTitledBorder ("newItemDescriptionPanel"));
secondCategoryCheckBox = new JCheckBox ("The item was listed in a second category");
newItemDescriptionPanel.setVisible (false);
itemTitleLabel = new JLabel ("Item title");
itemTitleTextField = new JTextField (30);
subtitleLabel = new JLabel ("Subtitle ($0.50)");
subtitleTextField = new JTextField (30);
itemDescriptionLabel = new JLabel ("Item description");
itemDescriptionTextArea = new JEditorPane();
itemDescriptionTextArea.setContentType( "text/html" );
itemDescriptionTextArea.setEditable( false );
itemDescriptionTextArea.setPreferredSize(new Dimension (500,250));
itemDescriptionTextArea.setFont(new Font( "Serif", Font.PLAIN, 12 ));
itemDescriptionTextArea.setForeground( Color.black );
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 4;
displayScroller = new JScrollPane( itemDescriptionTextArea );
gridbag = new GridBagLayout ();
gridbag.setConstraints( displayScroller, gbc );
itemDescriptionTextArea.setEditable( true );
takeAdditionalSpacePanelCheckBox = new JPanel(new FlowLayout(FlowLayout.LEFT));
takeAdditionalSpacePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
takeAdditionalSpacePanelLabel = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
takeAdditionalSpacePanelLabel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
takeAdditionalSpacePanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
takeAdditionalSpacePanel3 = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
takeAdditionalSpacePanel4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
takeAdditionalSpacePanel5 = new JPanel(new FlowLayout(FlowLayout.LEFT));
//takeAdditionalSpacePanel2.setBorder (BorderFactory.createTitledBorder ("Additonal 2"));
takeAdditionalSpacePanelCheckBox.add (secondCategoryCheckBox);
newItemDescriptionPanel.add (takeAdditionalSpacePanelCheckBox);
//newItemDescriptionPanel.add (blankLabel);
takeAdditionalSpacePanelLabel.add (itemTitleLabel);
takeAdditionalSpacePanelLabel.add (requiredLabel);
newItemDescriptionPanel.add (takeAdditionalSpacePanelLabel);
//newItemDescriptionPanel.add (itemTitleTextField);
takeAdditionalSpacePanel.add(itemTitleTextField);//<--add textfield to panel
newItemDescriptionPanel.add (takeAdditionalSpacePanel);//<--add panel to boxlayout panel
takeAdditionalSpacePanelLabel2.add (subtitleLabel);
newItemDescriptionPanel.add (takeAdditionalSpacePanelLabel2);
takeAdditionalSpacePanel2.add (subtitleTextField);
newItemDescriptionPanel.add (takeAdditionalSpacePanel2);
takeAdditionalSpacePanel4.add (itemDescriptionLabel);
//takeAdditionalSpacePanel4.add (requiredLabel2);
newItemDescriptionPanel.add (takeAdditionalSpacePanel4);
takeAdditionalSpacePanel3.add (displayScroller);
newItemDescriptionPanel.add (takeAdditionalSpacePanel3);
takeAdditionalSpacePanel5.add (backToRadioButton);
takeAdditionalSpacePanel5.add (itemDescriptionContinueButton);
newItemDescriptionPanel.add (takeAdditionalSpacePanel5);
//newItemDescriptionPanel.setLayout (new BoxLayout(newItemDescriptionPanel, BoxLayout.Y_AXIS));
//----------- Price Enter Page ----------------
priceEnterPanel = new JPanel();
priceEnterPanel.setLayout (new BoxLayout(priceEnterPanel, BoxLayout.Y_AXIS));
newItemDescriptionPanel.add (priceEnterPanel, BorderLayout.NORTH);
priceEnterPanel.setBorder (BorderFactory.createTitledBorder ("Price enter Panel"));
priceEnterPanel.setVisible (false);
priceEnterPanelScroll = new JScrollPane (priceEnterPanel);
topPanel.add (priceEnterPanelScroll);
standardPictureRadioButton = new JRadioButton ("Standard");
picturePackRadioButton = new JRadioButton ("Picture Pack ($1.00 for up to 6 pictures or $1.50 for 7 to 12 pictures)");
bgPictures = new ButtonGroup();
bgPictures.add(standardPictureRadioButton);
bgPictures.add(picturePackRadioButton);
standardPictureRadioButton.addActionListener (ears);
picturePackRadioButton.addActionListener (ears);
superSizePicturesCheckBox = new JCheckBox ("Supersize Pictures ($0.75)");
listingDesignerCheckBox = new JCheckBox ("Listing designer $0.10");
valuePackCheckBox = new JCheckBox ("Get the Essentials for less! Gallery, Subtitle, Listing Designer. $0.65 (save $0.30)");
superSizePicturesCheckBox.setEnabled (false);
superSizePicturesCheckBox.addActionListener (ears);
listingDesignerCheckBox.addActionListener (ears);
valuePackCheckBox.addActionListener (ears);
startingPriceLabel = new JLabel ("Starting Price");
dollarSignLabel = new JLabel ("$");
startingPriceTextField = new JTextField (10);
buyItNowLabel = new JLabel ("Buy It Now");
dollarSignLabel2 = new JLabel ("$");
buyItNowTextField = new JTextField (10);
donatePercentageLabel = new JLabel ("Donate percentage of sale");
donatePercentageTextField = new JTextField (2);
donatePercentageTextField.setText ("0");
percentageLabel = new JLabel ("%");
// Right-justify the text
donatePercentageTextField.setHorizontalAlignment(JTextField.RIGHT);
numberOfPicturesLabel = new JLabel ("Number of pictures used");
numberOfPicturesTextField = new JTextField (1);
numberOfPicturesTextField.setText ("0");
galleryPictureCheckBox = new JCheckBox ("Gallery ($0.35) [Requires a picture]");
subtitleCheckBox = new JCheckBox ("Subtitle ($0.50)");
boldCheckBox = new JCheckBox ("Bold ($1.00)");
borderCheckBox = new JCheckBox ("Border ($3.00)");
highlightCheckBox = new JCheckBox ("Highlight ($5.00)");
featuredPlusCheckBox = new JCheckBox ("Featured Plus! ($19.95)");
galleryFeaturedCheckBox = new JCheckBox ("Gallery Featured ($19.95) [Requires a picture]");
homePageFeaturedLabel = new JLabel ("Home Page Featured ($39.95 for 1 item, $79.95 for 2 or more items)");
homePageFeaturedComboBox = new JComboBox ();
homePageFeaturedComboBox.addItem (("None..."));
homePageFeaturedComboBox.addItem (("1 item"));
homePageFeaturedComboBox.addItem (("2 or more items"));
giftCheckBox = new JCheckBox ("Show as a gift ($0.25)");
fillUpSpacePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel5 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel6 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel7 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel8 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel9 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel10 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel11 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel12 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel13 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel14 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel15 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel16 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel17 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel18 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp5 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp6 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp7 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp8 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fSp9 = new JPanel(new FlowLayout(FlowLayout.LEFT));
fillUpSpacePanel.add (startingPriceLabel);
fillUpSpacePanel.add (requiredLabel2);
priceEnterPanel.add (fillUpSpacePanel);
fillUpSpacePanel2.add (dollarSignLabel);
fillUpSpacePanel2.add (startingPriceTextField);
priceEnterPanel.add (fillUpSpacePanel2);
// fillUpSpacePanel1.add (backToItemDescriptionButton);
// priceEnterPanel.add (fillUpSpacePanel1);
fillUpSpacePanel3.add (buyItNowLabel);
priceEnterPanel.add (fillUpSpacePanel3);
fillUpSpacePanel4.add (dollarSignLabel2);
fillUpSpacePanel4.add (buyItNowTextField);
priceEnterPanel.add (fillUpSpacePanel4);
fillUpSpacePanel1.add (donatePercentageLabel);
priceEnterPanel.add (fillUpSpacePanel1);
fillUpSpacePanel5.add (donatePercentageTextField);
fillUpSpacePanel5.add (percentageLabel);
priceEnterPanel.add (fillUpSpacePanel5);
fillUpSpacePanel6.add (numberOfPicturesLabel);
priceEnterPanel.add (fillUpSpacePanel6);
fillUpSpacePanel7.add (numberOfPicturesTextField);
priceEnterPanel.add (fillUpSpacePanel7);
fillUpSpacePanel8.add (standardPictureRadioButton);
priceEnterPanel.add (fillUpSpacePanel8);
fillUpSpacePanel10.add (blankLabel);
fillUpSpacePanel10.add (superSizePicturesCheckBox);
priceEnterPanel.add (fillUpSpacePanel10);
fillUpSpacePanel9.add (picturePackRadioButton);
priceEnterPanel.add (fillUpSpacePanel10);
fillUpSpacePanel11.add (picturePackRadioButton);
priceEnterPanel.add (fillUpSpacePanel11);
fillUpSpacePanel12.add (listingDesignerCheckBox);
priceEnterPanel.add (fillUpSpacePanel12);
fillUpSpacePanel13.add (valuePackCheckBox);
priceEnterPanel.add (fillUpSpacePanel13);
fSp.add (galleryPictureCheckBox);
priceEnterPanel.add (fSp);
fSp1.add (subtitleCheckBox);
priceEnterPanel.add (fSp1);
fSp2.add (boldCheckBox);
priceEnterPanel.add (fSp2);
fSp3.add (borderCheckBox);
priceEnterPanel.add (fSp3);
fSp4.add (highlightCheckBox);
priceEnterPanel.add (fSp4);
fSp5.add (featuredPlusCheckBox);
priceEnterPanel.add (fSp5);
fSp6.add (galleryFeaturedCheckBox);
priceEnterPanel.add (fSp6);
fSp7.add (homePageFeaturedLabel);
priceEnterPanel.add (fSp7);
fSp8.add (homePageFeaturedComboBox);
priceEnterPanel.add (fSp8);
fSp9.add (giftCheckBox);
priceEnterPanel.add (fSp9);
newItemDescriptionPanel.add (priceEnterPanelScroll);
//Create the panel that contains the "cards".
cards = new JPanel(new CardLayout());
cards.add(newItemPanel, RADIOPANEL);
cards.add(newItemDescriptionPanel, DESCRIPTIONPANEL);
cards.add(priceEnterPanel, PRICEENTERPANEL);
topPanel.add(cards, BorderLayout.NORTH);
// Create the menu bar
menuBar = new JMenuBar();
// Set this instance as the application's menu bar
setJMenuBar( menuBar );
// Build the property sub-menu
menuProperty = new JMenu( "Properties" );
menuProperty.setMnemonic( 'P' );
// Create property items
menuPropertySystem = CreateMenuItem( menuProperty, ITEM_PLAIN,
"System...", null, 'S', null );
menuPropertyEditor = CreateMenuItem( menuProperty, ITEM_PLAIN,
"Editor...", null, 'E', null );
menuPropertyDisplay = CreateMenuItem( menuProperty, ITEM_PLAIN,
"Display...", null, 'D', null );
//Build the File-New sub-menu
menuFileNew = new JMenu ("New");
menuFileNew.setMnemonic ('N');
//Create File-New items
menuFileNewItem = CreateMenuItem( menuFileNew, ITEM_PLAIN,
"Item", null, 'A', null );
menuFileNewAccount = CreateMenuItem( menuFileNew, ITEM_PLAIN,
"Account", null, 'A', null );
// Create the file menu
menuFile = new JMenu( "File" );
menuFile.setMnemonic( 'F' );
menuBar.add( menuFile );
//Add the File-New menu
menuFile.add( menuFileNew );
// Create the file menu
// Build a file menu items
menuFileOpen = CreateMenuItem( menuFile, ITEM_PLAIN, "Open...",
new ImageIcon( "open.gif" ), 'O',
"Open a new file" );
menuFileSave = CreateMenuItem( menuFile, ITEM_PLAIN, "Save",
new ImageIcon( "save.gif" ), 'S',
" Save this file" );
menuFileSaveAs = CreateMenuItem( menuFile, ITEM_PLAIN,
"Save As...", null, 'A',
"Save this data to a new file" );
// Add the property menu
menuFile.addSeparator();
menuFile.add( menuProperty );
menuFile.addSeparator();
menuFileExit = CreateMenuItem( menuFile, ITEM_PLAIN,
"Exit", null, 'X',
"Exit the program" );
//menuFileExit.addActionListener(this);
// Create the file menu
menuEdit = new JMenu( "Edit" );
menuEdit.setMnemonic( 'E' );
menuBar.add( menuEdit );
// Create edit menu options
menuEditCut = CreateMenuItem( menuEdit, ITEM_PLAIN,
"Cut", null, 'T',
"Cut data to the clipboard" );
menuEditCopy = CreateMenuItem( menuEdit, ITEM_PLAIN,
"Copy", null, 'C',
"Copy data to the clipboard" );
menuEditPaste = CreateMenuItem( menuEdit, ITEM_PLAIN,
"Paste", null, 'P',
"Paste data from the clipboard" );
public JMenuItem CreateMenuItem( JMenu menu, int iType, String sText,
ImageIcon image, int acceleratorKey,
String sToolTip )
// Create the item
JMenuItem menuItem;
switch( iType )
case ITEM_RADIO:
menuItem = new JRadioButtonMenuItem();
break;
case ITEM_CHECK:
menuItem = new JCheckBoxMenuItem();
break;
default:
menuItem = new JMenuItem();
break;
// Add the item test
menuItem.setText( sText );
// Add the optional icon
if( image != null )
menuItem.setIcon( image );
// Add the accelerator key
if( acceleratorKey > 0 )
menuItem.setMnemonic( acceleratorKey );
// Add the optional tool tip text
if( sToolTip != null )
menuItem.setToolTipText( sToolTip );
// Add an action handler to this menu item
menuItem.addActionListener( this );
menu.add( menuItem );
return menuItem;
public void actionPerformed( ActionEvent event )
CardLayout cl = (CardLayout)(cards.getLayout());
if (event.getSource() == menuFileExit)
System.exit(0);
if (event.getSource() == menuFileNewAccount)
System.out.println ("hlkadflkajfalkdjfalksfj");
if (event.getSource() == menuFileNewItem){
if (firstRun){
newItemPanel.setVisible (true);
topPanel.setVisible (true);
cl.show(cards,RADIOPANEL);
firstRun = false;
//System.out.println( event );
private class ButtonListener implements ActionListener
public void actionPerformed(ActionEvent event)
CardLayout cl = (CardLayout)(cards.getLayout());
// cl.show(cards, (String)evt.getItem());
if (event.getSource() == continueButton){
if (!(onlineAuctionRadio.isSelected()) && !(fixedPriceRadio.isSelected()))
JOptionPane.showMessageDialog(null, "You must select at least one.", "Error", JOptionPane.ERROR_MESSAGE);
else{
if (onlineAuctionRadio.isSelected()){
cl.show (cards, DESCRIPTIONPANEL);
//newItemPanel.setVisible (false);
//newItemDescriptionPanel.setVisible (true);
if (event.getSource() == itemDescriptionContinueButton){
if (itemTitleTextField.getText().trim().equalsIgnoreCase(""))
JOptionPane.showMessageDialog(null, "You must enter a title.", "Error", JOptionPane.ERROR_MESSAGE);
else
cl.show (cards, PRICEENTERPANEL);
if (event.getSource() == backToRadioButton){
cl.show (cards, RADIOPANEL);
if (event.getSource() == backToItemDescriptionButton){
cl.show(cards, DESCRIPTIONPANEL);
if (standardPictureRadioButton.isSelected()){
superSizePicturesCheckBox.setEnabled (true);
if (picturePackRadioButton.isSelected()){
superSizePicturesCheckBox.setEnabled (false);
} //end of action performed
}Mostly I see there is about 100 times as much code as I care to look at.
So you don't know how to get a panel in a scroll pane, and then get that scroll pane into your GUI? Then try doing that by itself, not encumbered with 10000 lines of irrelevant code. Once you have it working, plug it into the big lump of code. Or if you can't get it working, ask about the small problem here. -
Scroll bar problem...please help !
I have 2 blocks. The first is master with a SCROLLING BAR, and the other one is detail. I wanna do some validations when the scroll bar of the master is scrolled...and i tried the forms trigger, KEY-SCRDOWN, but in version 4.5 of forms is doesn't fire. I tried with version 6i, but the trigger didn't fire. Could someone tell me how i am suppose to catch a scroll bar move if the KEY-SCRDOWN isn't working ?
Thank you.Than you but i'm now 1 record after or behind the one i need to validate if some changes have been made ! Your answer is not bad, but i want to stop the scroll if the record is "CHANGED". Anybody help me !
-
Scroll Bar Troubles, Please Help.
When In A WebPage, I Have No Scroll Bars, And The Up And Down Arrows Will Not Scroll The Page Either. The Only Way I Can Scroll Is By Dragging The Screen Up And Down By Highlighting And It's Rather Bugging Now. I'm New To Macs By Two Weeks So Please Please Help.
ThankYou.What browser are you using? Do you get this condition on all web pages you access?
-
Scroll Bar code in Awt Required Plz Help me
Hi,
My requirment is to add Vertical Scrollbar to the table.There are 12 rows in a table like from January to December.
I am able to see data of rows as jan,feb,mar,apr only .
i want to see the data of rows of next months by adding vertical scroll bar using Awt code.
I added vertical scroll bar using awt code. When i click on that Vertical scroll bar event is going to below method.
public void adjustmentValueChanged(AdjustmentEvent e) {
I tried with some logic inside above method but it is not working.what is the code i have to write inside the above method inorder to scroll the next months.
Plz Help me.
Thanks In Advance.........But i want to do this code In Using Awt only......Well, a JTable is a Swing component so I have no idea what you are talking about.
To control the size of the table you can use:
table.setPreferredScrollableViewportSize(???);
JScrollPane scrollPane = new JScrollPane( table ); -
Help with a vertical scroll bar issue with a List component
hi. i have a basic <s:list> that uses an XMLListCollection as it's data provider and a very basic itemrenderer. when a row in the list is clicked a function gets the list.selectedIndex then populates some text fields with more xml data. that all works fine.. the problem i have is that the vertical scroll bar on the list seems to be "clickable" - just like a row in the list. the scroll bar scrolls normally but when it's clicked the selectedIndex becomes -1 which is not helpful b/c the value -1 is passed to the XMLListCollection.
any ideas? cheers.thanks but still problematic...surely the <s:List> component shouldn't return a value when the scrollbar thumb is clicked? i created a very basic list (see below) and made the list dimensions short enough so that there is a vertical scrollbar and found that when the scrollbar thumb is clicked the trace(event.currentTarget.selectedIndex) returns a number. that's annoying b/c i just want a selectedIndex value for a row that is clicked not the scrollbar.
any ideas to get around? cheers
<fx:Script>
<![CDATA[
protected function list1_clickHandler(event:MouseEvent):void
trace(event.currentTarget.selectedIndex);
]]>
</fx:Script>
<s:List x="162" click="list1_clickHandler(event)" y="276" labelField="@label" width="144" height="153">
<s:dataProvider>
<s:XMLListCollection>
<fx:XMLList xmlns="">
<node label="one"/>
<node label="two"/>
<node label="three"/>
<node label="four"/>
<node label="five"/>
<node label="six"/>
<node label="seven"/>
<node label="eight"/>
<node label="nine"/>
<node label="ten"/>
<node label="eleven"/>
</fx:XMLList>
</s:XMLListCollection>
</s:dataProvider>
</s:List> -
Scroll bar, buttons and a Custom Component - help
Thanks to another forum I was able to create a scroll panel and add a scroll bar to it. That works fine. Inside the scroll panel I have thumbnails of the product that I'm highlighting. I want to be able to click on the thumbnail and have a full size photo of the product come up in the window next to the scroll panel. I created a custom component that has a stage showing each full size product individually. This worked fine when I simply had buttons and no scroll bar. I could convert the thumbnail to a button and then add interaction so that it would go to the proper state of the custom component. Where I'm having problems is now that I've imbedded the buttons in a scroll panel I'm no longer given the custom component as an option to pick from. I can add interaction, but it only gives me the option of picking one of the pages, and not a component.
I've attached a screen grab to help show what I'm describing.
Any ideas?
DougDoug, thanks for asking this question.
Hi ADAM...
It seems that a lot of us are asking the same question: Scrollbar Navigation-Make Actionable
(I created a low-fidelity proof-of-concept to test—using a datalist as you suggested. See link in my posting).
I have reviewed the video you refer to here, but you example still does not allow for individual items in the datalist (scrollbar) to be assigned individual actionable events.
Can you expain your thinking in Option 1, as a workaround? Do you have any other suggestions?
BOTTOM LINE
We are all looking to do the same thing... something we are going to see A LOT MORE of after Uncle Steve's TABLET presentation next week:
A scrolling menu, with selected items in the menu causing "navigation" to a certain point in a scroll panel. (imitating the flick or slide effect of iPhone).
Suggestion: Can you add a field to thedatalist so that when the "repeated item" (in edit mode) is configuredto do an action (i.e., On-Click, Transition to State), we can then assign the state you'd like for each item in thetable itself?
Now the issue is making it change the "State" within another component (i.e. scrolling panel). Can that be done?
Thanks,
- Rick -
Scroll bar goes crazy and active window jumps around in size - Help
I've got iTunes 7.0.5 installed. If I use iTunes for any length of time, my system goes crazy. The scroll bar on whatever program I make active goes up and down like mad, while the content of the active window shrinks and magnifies in size multiple times a second. It's very bizarre and consistently happens only when I run iTunes for some length of time. I have no problem if I choose Windows Media Player. It's very disturbing, as I can no longer use iTunes. Any help in knowing how to fix the problem, or even to trouble shoot it further, would be greatly appreciated.
Here are a couple of thoughts on the Timeline scrolling and other possible display issues:
1.) make sure that you have the very latest video driver - the very latest
2,) if you have Vista, turn Aero and Sidebar off
3.) if you have Window Blinds, get the very latest version
4.) if you have an InteliPoint mouse driver, try removing it, and using the standard Windows mouse driver instead*
5.) if you have a laptop and both the touch-pad and a mouse are installed and ON, turn the touch-pad OFF
These are some suggestions that might affect your display issues.
Good luck,
Hunt
* The MS InteliPoint has caused many display issues with Adobe products. Most often, these have manifested themselves in flashing GUI's and similar, but other odd behaviors have been experienced. If the removal of InteliPoint does help, try the very latest version, but be ready to revert to the standard Windows mouse driver. -
I have not found the scroll bar I need yet... any help would be great!
Anyone know where I can get a scroll bar that has two
important capabilities:
1). It can be re-skinned so that the dragging scroll bar
stays at a fixed height. I re-skinned the ScrollPane component and
the bar re-adjusts itself depending on the height of the entire
scroll pane. I need the scrollbar NOT to change its dimensions.
2). I can pass in something like the yPosition property to
move the scroll bar and its contents to a certain location based on
a variable. The yPosition works great using the ScrollPane but I
cannot skin it like I would like.
Any info would be great!
Thanks,
JoeThe following may help: iOS: Device not recognized in iTunes for Windows
Maybe you are looking for
-
Problemas com o Compartilhamento Familiar no Apple TV
Na terça-feira, tive o prazer de comprar o aparelho Apple TV, porém só hoje pude conectá-lo à internet e começar a trabalhar em cima dele. O Compartilhamento de Fotos e conteúdo dos aparelhos Apple daqui de casa funciona perfeitamente, porém quando t
-
Oracle 8.1.7 on Windows 2003
I'm trying to install Oracle 8.1.7 on Windows 2003 Server and it's hanging at the place, where installation tries to configure Net8 services. When I try to stop the process and try to create database - it gives error message as "TNS:protocol adapter
-
Where to find Adobe Photoshop CS6 Extended?
Hi, I did download the Adobe Photoshop CS6 trial, via the website I did go to the Download Manager. Now I have it installed, but i'm not sure if I have the extended or normal version. How can I check that? And, if I don't have it.. The download manag
-
Mobility tags in WegLogic Portal 9.2
Has anyone successfully used the mobility tags <mm:layout> and <mm:group> in WebLogic Portal 9.2 in the way described, for example, on page 62 of the WebLogic Mobility Server User Guide (I'm looking at v3.5, Sept 2006)? I am trying to user a differen
-
Photoshop Pen Tool: Welding Points?
I am working with Photoshop CS3 and I have 3 paths that were on different layers until I moved them all to 1 layer. I can select all of the paths with the Path Selection Tool and "Combine" them into 1 path... but this doesn't do what I need it to.