Problem with two JLabels on panel on mouseover

Hello all,
I have created a JPanel and I have placed two JLabels on it. I have assigned an icon to each of them. What I want to do is to change this icons to different ones (a "highlighted" version of them) for each one of my JLabels when the mouse is over them. My problem is that with the code i have right now, both change when I mouse over only the first one while nothing happens when i do the same for the 2nd one. As a second step I want to move this two labels along the y-axis. Again only jLabel1 can be moved and only for a few points (that seem to be on the bounds of its original bounds) and jLabel2 gets the exact same movement even though I'm not dragging over it. I hope it's clear what I want to do. So my question is: i) why both my jLabels get highlighted when I mouse over the one and ii) why i can move my jLabel only to a restricted area in the screen? (actually I know the reason for this but I still cannot understand why it's happening: when I drag my image, it doesn't update its location. So if I mouse over its initial location it gets highlighted which means that it thinks it's still there for some reason, although it's repainted in its new position..)
package Viewer;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
* @author  Laura
public class Test2 extends javax.swing.JPanel {
    BufferedImage  img1=null;
    BufferedImage  img2=null;
    BufferedImage  img3=null;
    BufferedImage  img4=null;
    ImageIcon icon1=null;
    ImageIcon icon2=null;
    ImageIcon icon1_h=null;
    ImageIcon icon2_h=null;
    JLabel jLabel1;
    JLabel jLabel2;
    public Test2 (ColoringProperties parent) {
        try {
            img1=ImageIO.read((getClass().getResource("/arrow_right.gif")));
            icon1=new ImageIcon(img1);
            img2=ImageIO.read((getClass().getResource("/arrow_left.gif")));
            icon2=new ImageIcon(img2);
            img3=ImageIO.read((getClass().getResource("/arrow_right_highlighted.gif")));
            icon1_h=new ImageIcon(img3);
            img4=ImageIO.read((getClass().getResource("/arrow_left_highlighted.gif")));
            icon2_h=new ImageIcon(img4);
        } catch (IOException exc) {
        initComponents();
        jLabel1=new JLabel(icon1);
        jLabel2=new JLabel(icon2);
        this.add(jLabel1);
        this.add(jLabel2);
    public void PlaceIcons(){
        Dimension size = this.getSize();
        if (icon1 != null) {
            jLabel1.setBounds(0, 0,icon1.getIconWidth(),icon1.getIconHeight());
            jLabel1.setOpaque(true);
        } else {
            System.err.println("icon not found; using black square instead.");
            jLabel1.setBounds(0, 0, 30, 30);
            jLabel1.setOpaque(true);
            jLabel1.setBackground(Color.BLACK);
        if (icon2 != null) {
            jLabel2.setBounds(size.width - icon2.getIconWidth(), size.height - icon2.getIconHeight(),
                    icon2.getIconWidth(),icon2.getIconHeight());  
            jLabel2.setOpaque(true);
        } else {
            System.err.println("icon not found; using black square instead.");
            jLabel2.setBounds(0, 0, 30, 30);
            jLabel2.setOpaque(true);
            jLabel2.setBackground(Color.BLACK);
    private void initComponents() {
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                formMouseEntered(evt);
            public void mouseExited(java.awt.event.MouseEvent evt) {
                formMouseExited(evt);
        addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                formMouseDragged(evt);
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                formMouseMoved(evt);
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 54, Short.MAX_VALUE)
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 323, Short.MAX_VALUE)
    private void formMouseExited(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        this.jLabel1.setIcon(this.icon1);
        this.jLabel2.setIcon(this.icon2);
        this.repaint();
    private void formMouseMoved(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        Point p=new Point(evt.getPoint());
        if (this.jLabel1.contains(p)){
            this.jLabel1.setIcon(this.icon1_h);
            this.repaint();
        else {
            this.jLabel1.setIcon(this.icon1);
            this.repaint();
        if (this.jLabel2.contains(p)){
            this.jLabel2.setIcon(this.icon2_h);
            this.repaint();
        else{
            this.jLabel2.setIcon(this.icon2);
            this.repaint();
    private void formMouseDragged(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        Point p=new Point(evt.getPoint());
        if (this.jLabel1.contains(p)){
            Point init=this.jLabel1.getLocation();
            this.jLabel1.setLocation(init.x,p.y);
            this.repaint();
        if (this.jLabel2.contains(p)){
            Point init=this.jLabel2.getLocation();
            this.jLabel2.setLocation(init.x,p.y);
            this.repaint();
}Any help would be appreciated. I'm not an experienced programmer and I'm using NetBeans IDE 6.0.1 (if that's of any help)
Thank you,
Laura

Thanx for the replies!
I did what Rodney suggested and indeed the Labels now move independently. However, there is a lot of flickering and a ghost label appears that moves respectively with the original one i'm dragging (for both of them). Any ideas why is that?
Thank you again,
Laura
package Viewer;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
* @author  Laura
public class Test2 extends javax.swing.JPanel {
    BufferedImage  img1=null;
    BufferedImage  img2=null;
    BufferedImage  img3=null;
    BufferedImage  img4=null;
    ImageIcon icon1=null;
    ImageIcon icon2=null;
    ImageIcon icon1_h=null;
    ImageIcon icon2_h=null;
    public Test2(ColoringProperties parent) {
        try {
            img1=ImageIO.read((getClass().getResource("/arrow_right.gif")));
            icon1=new ImageIcon(img1);
            img2=ImageIO.read((getClass().getResource("/arrow_left.gif")));
            icon2=new ImageIcon(img2);
            img3=ImageIO.read((getClass().getResource("/arrow_right_highlighted.gif")));
            icon1_h=new ImageIcon(img3);
            img4=ImageIO.read((getClass().getResource("/arrow_left_highlighted.gif")));
            icon2_h=new ImageIcon(img4);
        } catch (IOException exc) {
        initComponents();       
    public void PlaceArrows(){
        Dimension size = this.getSize();
        if (icon1 != null) {
            jLabel1.setBounds(0, 0,icon1.getIconWidth(),icon1.getIconHeight());
            jLabel1.setOpaque(true);
        } else {
            System.err.println("icon not found; using black square instead.");
            jLabel1.setBounds(0, 0, 30, 30);
            jLabel1.setOpaque(true);
            jLabel1.setBackground(Color.BLACK);
        if (icon2 != null) {
            jLabel2.setBounds(size.width - icon2.getIconWidth(), size.height - icon2.getIconHeight(),
                    icon2.getIconWidth(),icon2.getIconHeight());  
            jLabel2.setOpaque(true);
        } else {
            System.err.println("icon not found; using black square instead.");
            jLabel2.setBounds(0, 0, 30, 30);
            jLabel2.setOpaque(true);
            jLabel2.setBackground(Color.BLACK);
    private void initComponents() {
        jLabel1 = new JLabel(icon1);
        jLabel2 = new JLabel(icon2);
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                formMouseEntered(evt);
            public void mouseExited(java.awt.event.MouseEvent evt) {
                formMouseExited(evt);
        addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                formMouseDragged(evt);
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                formMouseMoved(evt);
        jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jLabel1MouseEntered(evt);
            public void mouseExited(java.awt.event.MouseEvent evt) {
                jLabel1MouseExited(evt);
        jLabel1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                jLabel1MouseDragged(evt);
        jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jLabel2MouseEntered(evt);
            public void mouseExited(java.awt.event.MouseEvent evt) {
                jLabel2MouseExited(evt);
        jLabel2.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                jLabel2MouseDragged(evt);
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(41, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(42, Short.MAX_VALUE)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 295, Short.MAX_VALUE)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
    private void formMouseEntered(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:       
    private void formMouseExited(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    private void formMouseMoved(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    private void formMouseDragged(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    private void jLabel1MouseEntered(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        this.jLabel1.setIcon(this.icon1_h);
        this.jLabel1.revalidate();
        this.repaint();
    private void jLabel1MouseExited(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        this.jLabel1.setIcon(this.icon1);
        this.jLabel1.revalidate();
        this.repaint();
    private void jLabel1MouseDragged(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        Point w=new Point(evt.getPoint());
        if (w.y>0 && w.y<this.getHeight()){
            Point init=this.jLabel1.getLocation();
            this.jLabel1.setIcon(this.icon1_h);
            this.jLabel1.setLocation(init.x,w.y);
            this.jLabel1.revalidate();
            this.jLabel1.repaint();
    private void jLabel2MouseEntered(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        this.jLabel2.setIcon(this.icon2_h);
    private void jLabel2MouseExited(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        this.jLabel2.setIcon(this.icon2);
    private void jLabel2MouseDragged(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        Point p=new Point(evt.getPoint());
        if (p.y>0 && p.y<this.getHeight()){
            Point init=this.jLabel2.getLocation();
            this.jLabel2.setIcon(this.icon2_h);
            this.jLabel2.setLocation((int)init.getX(),(int)p.getY());
    // Variables declaration - do not modify
    public javax.swing.JLabel jLabel1;
    public javax.swing.JLabel jLabel2;
    // End of variables declaration
}

Similar Messages

  • Problem with two of my business rule triggers

    Good morning every one,
    I have a small problem with two of my business rule triggers.
    I have these tables:
    pms_activity
    csh_cash
    csh_integrate_leh
    csh_integrate_led
    and my process goes like this:
    upon approval of a row in my pms_activity table I have a trigger that insert a row in my csh_cash - and in the csh_cash table I have a trigger that will insert in the csh_ingerate_leh and csh_integrate_led.
    my problem is pms_activity does generate a row in csh_cash but the trigger in the cash does not fire to generate a row in the csh_integrate_leh and led tables.
    I have generated in the following order after I created my business rule:
    I have generated the table from the designer (server module tab)
    I have generated the CAPI from the head start utility
    I have generated the API from the designer
    I have generated the CAPI from the designer
    I have run the recompil.sql
    I have checked that my business rule trigger is enabled and should run on insert and no where restriction
    === this is my business rule logic ======
    l_rule_ok boolean := true;
    begin
    trace('br_csh001_cev (f)');
    csh_gl_pkg.csh_gen_integ_jvs(p_id
    ,p_ref_num
    ,p_own_id
    ,p_trt_id
    ,p_value_date
    ,p_description
    ,p_amount
    ,p_cur_id
    ,p_gla_dr
    ,p_gla_cr
    ,p_gla_pl
    ,p_gla_rev
    ,p_gla_eqt);
    return l_rule_ok;
    exception
    when others
    then
    qms$errors.unhandled_exception(PACKAGE_NAME||'.br_csh001_cev (f)');
    end br_csh001_cev;
    ==== end =======================
    Any help will be appreciated as I have struggled with this for two days.
    Thanks

    hmmm...
    Try resetting it again and restoring with the same backup file...
    Does the phone work properly once you've reset it before you try restoring? A lot of people here have experienced problems restoring from backups... could be worth forgetting about it and starting from scratch.
    You could try contacting your nearest Nokia Service Centre (www.nokia.com/repair) and see if they can do anything - it may need the firmware reinstalling or upgrading... possibly... give them a call though and see.
    Nokia History: 3110, 5110, 7110, 7110, 3510i, 6210, 6310i, 5210, 6100, 6610, 7250, 7250i, 6650, 6230, 6230i, 6260, N70, N70, 5300, N95, N95, E71, E72
    Android History: HTC Desire, SE Xperia Arc, HTC Sensation, Sensation XE, One X+, Google Nexus 5

  • I have a problem with two PDF's when trying to open them through a link on a web page. The two PDF's open fine with Adobe on my own PC and on the server I have copied it to but when they are opened through a link on a web page (pointing to the server wher

    I have a problem with two PDF's when trying to open them through a link on a web page. The two PDF's open fine with Adobe on my own PC and on the server I have copied it to but when they are opened through a link on a web page (pointing to the server where the PDFs open fine) I get an error 'There was an error processing a page. Invalid function resource' The other one just doesn't open at all. Can anyone help with this please?

    Hello,
    Are the pdf linked correctly in the website? Is this a public website? If yes, please post the link here.
    ~Deepak

  • Problem with two monitors while using Photoshop, windows move from 2nd screen to 1st screen.

    Problem with two monitors while using Photoshop, windows move from 2nd screen to 1st screen.
    I saved a new workspace and it did not help.
    No problem before I went to Maverick.

    I found the fix, go to System Preferences and open Mission Control and uncheck the box to keep monitors as they were (When switching to an application...........)

  • Problem with Creative Audio Control Panel

    ) Heya, I just bought a SB X-Fi Xtreme Audio and I've encountered a problem with Creative Audio Control Panel. My OS is Win7 x64; I have installed the newest drivers for SB. The problem is that I can't set my setup for headphones. I mean I can do that and it's working untill I turn off the PC or restart the system. After that it always sets for 2/2. Speakers. Any ideas how to make this thing to remember my settings the way I want it's Thanks!

    - The problem seems to be fixed Here's the solution for my card: <a rel="nofollow" target="_blank" href="http://forums.creative.com/t5/Sound-Blaster/SB-P7X-Series-Support-Pack-2-5-02-06-200-AudigySE-Value-LS/m-p/5493" title="Linkification: http://forums.creative.com/t5/Sound-Blaster/SB-P7X-Series-Support-Pack-2-5-02-06-200-AudigySE-Value-LS/m-p/5493"]http://forums.creative.com/t5/Sound-Blaster/SB-P7X-Series-Support-Pack-2-5-02-06-200-AudigySE-Value-LS/m-p/5493[/url]

  • Little problems with two sensors

    Hi
    I've got a problem with two sensors.
    First, the luminosity sensor. I'd like to set the brightness to a fixed value. It would not vary from darkness to bright sunlight.
    Then, when i'm typing in landscape mode, it often switches back to portrait mode, wich make me terribly angry as i lose too much time.
    How can i solve these two problems ?
    Is there a special app?
    Last, but least, does anyone know if an app that would allow to take HDR/exposure blending pictures exist ? It'd take 3 to 5 photos with different exposures, and if it merged them to a good tonemapped picture it would be perfect.
    Thanks

     The light sensor can't be set to a fixed permanent value using the phones default settings, I'm afraid. You can only adjust it's sensitivity. However, some users have reported using an app to keep the screen set at maximum brightness.
     The motion sensor which switches the phone screen orientation has become more sensitive after the recent PR 1.1 update, so not a lot can be done about that either, apart from trying to hold the phone as steady  as possible when using it.
    Finally, there isn't any HDR available for the N8 at this time, nor is there any setting to increase the exposure time to something like a second, which would be a nice feature to add to  a great camera.
     All the best.
    Ray

  • Problem with two finger scrolling on s440

    Hello everyone
    I have a S440 (touch version) and some Problems with two finger scrolling on the touchpad.
    First, it isn't smooth, i.e.. If I move my fingers it only starts scrolling after a second or so, basically when I've already stopped (unless I move very slow). It then makes up for the lost time by scrolling very fast.
    The more serious problem (that makes it practically unusable) is that it randomly jumps back up, often to the top of the page/document, sometimes just a page or so.
    The problems are worst with firefox and acrobat, with IE and the Microsoft reader there's no response time problem but the jumping upwards still occurs.
    The problem is there with the preinstalled Windows 8 as well as my own Windows 8 Pro (with the original Lenovo drivers). Scrolling with the Trackpoint and an external mouse work fine, as well as scrolling via the touchscreen.
    Does anyone have any suggestion if/how I can fix this?

    I also have a S440 (non-touch screen), the scrolling on the touchpad worked perfectly when I bought it, no jumping, and scrolling perfectly smoothly comparable to an Mac. But after an upgrade to windows 8.1 which broke many things ( despite upgrading all drivers), I reset my thinkpad which brought it back to windows 8, everything working normally again except the two finger scrolling which is no longer smooth (moves incrementally now), and likes to jump randomly up or down the page, (not always, but enough to make it irritating. I notice this mostly with google chrome and adobe reader as these are the apps I use most frequently.
    So my questions is what drivers or settings do I need to bring the scrolling back to the configuration it was when I purchased my S440? My device manager says I'm running thinkpad ultranav with Synaptics driver version 16.6.4.38
    Cheers,
    Paul

  • Problems with Custom File Info Panel and Dublin Core

    I'm creating a custom file info panel that uses the values of the dublin core description and keywords (subject) for two of it's own fields.  I'm having problems with the panel saving if they enter the description on the custom panel first, and with the keywords not echoing each other, or reappearing after a save.<br /><br />Here is the code for the panel<br /><br /><?xml version="1.0"><br /><!DOCTYPE panel SYSTEM "http://ns.adobe.com/custompanels/1.0"><br /><panel title="$$$/matthew/FBPanelName=Testing for Matthew" version="1" type="custom_panel"><br />     group(placement: place_column, spacing:gSpace, horizontal: align_fill, vertical: align_top)<br />     {<br />          group(placement: place_row, spacing: gSpace, horizontal: align_fill, vertical: align_top)<br />          {<br />               static_text(name: '$$$/matthew/keywords = Keywords', font: font_big_right, vertical: align_center);<br />               edit_text(fbname: '$$$/matthew/keywordsFB = Keywords', locked: false, height: 60, v_scroller: true, horizontal: align_fill, xmp_ns_prefix: 'dc', xmp_namespace: <br />'http://purl.org/dc/elements/1.1/', xmp_path: 'subject');<br />          }<br />          group(placement: place_row, spacing: gSpace, horizontal: align_fill, vertical: align_top)<br />          {<br />               static_text(name: '$$$/matthew/description = Description', font: font_big_right, vertical: align_center);<br />               edit_text(fbname: '$$$/matthew/descriptionFB = Description', locked: false, height: 60, v_scroller: true, horizontal: align_fill, xmp_ns_prefix: 'dc', xmp_namespace: <br />'http://purl.org/dc/elements/1.1/', xmp_path: 'description');<br />          }<br />          group(placement: place_row, spacing: gSpace, horizontal: align_fill, vertical: align_top)<br />          {<br />               static_text(name: '$$$/matthew/season = Season', font: font_big_right, vertical: align_center);<br />               popup(fbname: '$$$/matthew/seasonFB = Season', items: '$$$/matthew/Season/Items={};option 3{option 3};option 2{option 2};option 1{option 1}', xmp_namespace:'http://monkeys.com/demo/testingmatthew/namespace/', xmp_ns_prefix:'matthew', xmp_path:'season');<br />          }<br />          group(placement: place_row, spacing: gSpace, horizontal: align_fill, vertical: align_top)<br />          {<br />               static_text(name: '$$$/matthew/ltf = Limited Text Field', font: font_big_right, vertical: align_center);<br />               edit_text(fbname: '$$$/matthew/ltf = Limited Text Field', locked: false, horizontal: align_fill, xmp_namespace:'http://monkeys.com/demo/testingmatthew/namespace/ ', <br />xmp_ns_prefix:'matthew', xmp_path:'ltf');<br />          }<br />     }<br /></panel><br /><br />Thanks for the help

    To answer my own question:
    The documentation really sucks.
    I found this reply from Adobe <http://forums.adobe.com/message/2540890#2540890>
    usually we recommend to install custom panels into the "user" location at:
    WINDOWS XP: C:\Documents and Settings\username\Application Data\Adobe\XMP\Custom File Info Panels\2.0\panels\
    WINDOWS VISTA: C\Users\username\AppData\Roaming\Adobe\XMP\Custom File Info Panels\2.0\panels\
    MAC OS: /user/username/Application Data/Adobe/XMP/Custom File Info Panels/2.0/panels/
    The reason why your panels did not work properly was a missing Flash trust file for that user location. Without such a trust file the embedded flash player refuses to "play" your custom panel.
    Please see section "Trust files for custom panels" in the XMPFileInfo SDK Programmer's Guide on page 50 for all details on how to create such trust files.
    After many wasted hours I have now the simple panels running.
    Cheers,
    H.Sup

  • OverlayLayout for JPanel with two JLabels

    I can't seem to get this to work or find information (not one of my books mentions OverlayLayout, nor is there a tutorial using one). Here's the layout (pardon the pun) of my app:
    JFrame
         JMenuBar
         JToolBar
         JPanel
              JScrollPane
                   JViewport
                        JPanel (view)
                             JLabel (background image)
                             JLabel (foreground drawing)
         JLabel (status bar)The JPanel (view) has an OverlayLayout so that the two JLabels can sit ontop of one another (as specified in the API docs for OverlayLayout - which is the only info to be found on the darned thing - and little at that). The JLabel (foreground drawing) is setOpaque(false) to see the image in JLabel (image). I see the image but not the drawing. The retrieved size for the JLabel (drawing) is (0,0), but if the preferredSize is set for it, it restricts everything inside the JScrollPane (JViewport, JPanel (view), and JLabel (image)) to that value and viewport changes are not broadcast.
    This is turning out to be a lose, lose, lose, lose situation. No matter what I need to do, I cannot get two of anything on top of each other inside a JScrollPane. Any suggestions or working code are greatly appreciated.
    Robert Templeton

    Okay, here's how I did it. Couple points of interest: You MUST use setPreferredSize(image.width,image.height) and NOT setSize(image.width,image.height). The latter has no effect on the JPanel's size. Set the layout for the JPanel to GridLayout and add just that one JLabel. It will be stretched to fit the entire JPanel. Set JLabel to setOpaque(false) and the image is visible with the drawing on top. Yay!
    In the JFrame's JPanel
              // Set up the scroll pane.
              sglass = new ScrollableGlassLabel();
              scroller = new ScrollablePicture(8);
              scroller.add(sglass);
              pictureScrollPane = new JScrollPane();
              // Create our own viewport, instead of the default one
              viewport = new IViewport(this,pictureScrollPane,scroller);
              pictureScrollPane.setViewport(viewport);
              // Setup our view in the scroll pane's viewport
              pictureScrollPane.setPreferredSize(new Dimension(256, 256));
              pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));
              // Put it in this panel.
              setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
              add(pictureScrollPane, 0);
              setBorder(BorderFactory.createEmptyBorder(20,20,20,20));ScrollablePicture:
    public class ScrollablePicture extends JPanel implements Scrollable {
         private int maxUnitIncrement = 1;
         Image image = null;
         public ScrollablePicture(int m) {
              super();
              maxUnitIncrement = m;
              setOpaque(false);
              setLayout(new GridLayout());
         public Dimension getPreferredScrollableViewportSize() {
              return getPreferredSize();
         public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
              //Get the current position.
              int currentPosition = 0;
              if (orientation == SwingConstants.HORIZONTAL)
                   currentPosition = visibleRect.x;
              else
                   currentPosition = visibleRect.y;
              //Return the number of pixels between currentPosition
              //and the nearest tick mark in the indicated direction.
              if (direction < 0) {
                   int newPosition = currentPosition - (currentPosition / maxUnitIncrement) * maxUnitIncrement;
                   return (newPosition == 0) ? maxUnitIncrement : newPosition;
              else {
                   return ((currentPosition / maxUnitIncrement) + 1) *     maxUnitIncrement - currentPosition;
         public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
              if (orientation == SwingConstants.HORIZONTAL)
                   return visibleRect.width - maxUnitIncrement;
              else
                   return visibleRect.height - maxUnitIncrement;
         public boolean getScrollableTracksViewportWidth()
              return false;
         public boolean getScrollableTracksViewportHeight()
              return false;
         public void setMaxUnitIncrement(int pixels)
              maxUnitIncrement = pixels;
         public void setImage(ImageIcon icon) {
              image = icon.getImage();
              setPreferredSize(new Dimension(icon.getIconWidth(),icon.getIconHeight()));
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              if(image != null)
                   g.drawImage(image, 0, 0, this);
    }ScrollableGlassLabel:
    public class ScrollableGlassLabel extends JLabel {
         private static Color[] colors = {
              Color.white, Color.black, Color.blue, Color.red, Color.yellow, Color.orange,
              Color.cyan, Color.pink, Color.magenta, Color.green };
         public ScrollableGlassLabel() {
              super();
              setOpaque(false);
         public void paintComponent(Graphics g) {
              int x, y, dx, dy;
              for(int i = 0; i < 32; i++) {
                   x = (int)(Math.random()*100);
                   y = (int)(Math.random()*100);
                   dx = (int)(Math.random()*100);
                   dy = (int)(Math.random()*100);
                   g.setColor(colors[(int)(Math.random()*10)]);
                   g.drawLine(x,y,x+dx,y+dy);
    }Right now, it just draws random lines, but it will be drawing 3D meshes soon.
    Thanks for you assistance, camickr. It at least got me thinking about alternatives.
    Robert Templeton

  • Problem with two thunderbolt display's daisychained

    hey,
    i'm having problems with my mac setup. i've got two thunderbolt displays, hooked to a 15" mbp retina laptop.
    i've got my iphone hooked to one of the usb ports of the display then i've got a keyboard, a superdrive and a charger for my magic mouse hooked to the displays as well as a firewire hd. two usb 3 hard drives are hooked directly to the mbp.
    i also changed the audio midi setup to let the audio pla through both of the displays to get a better sound. the mbp is closed so only those two displays get a video signal.
    i have issues when data is transfered along the lines. f.eg my keyboard doesn't work from time to time, my iphone wont be recognized when connected to the dock. not really sure what the problems is a the transfercapacity shouldn't be to it's limit.
    could it be a energy problem? that the displays don't get enough power, my power strip has a voltag controller in it, might that be a problem?
    greets.

    I think Apple should extend the warranty if they have a known manufacturing issue.  I won't be investing another $1000 on a display from Apple ever again.  I can't afford it.  I can by an LG, Viewsonic, Dell, or "fill in the blank" for a fraction of the cost.
    I expect a $1000 display to last me more than 20 months.
    -md

  • Strange refresh problem with two heavily used forums...

    Hi,
    For last two weeks, I have observed a strange problem with Database-General and SQL-PL/SQL forums, which are used heavily (comparatively more number of users than other forums).
    If I navigate from Forum Home (http://forums.oracle.com/forums/index.jspa?categoryID=84) to Database-General (General Database Discussions or PL/SQL forum (PL/SQL these forum pages open within 2-3 seconds but they open.
    But if I hit refresh (F5) from within these forums, 9 out of 10 times, I get a timeout or a page not found error.
    I can navigate back one page, click on link to go to Forum home and from there to Database-General or PL/SQL forum and everything works fine.
    I have tried clearing all caches, cookies and other settings on my Firefox (3.0.1) but it has not helped so far.
    Is this a known issue?

    Satish,
    I have to use the back button when after writing a reply, I am welcomed by 500_internal Service error. If I would refresh there, I lose what ever I have written. So I go back and again submit.
    For the refresh,at times ( and very often) , I find forums being slow like dead. Ironically with the reply button,thread(s) work but otherwise not. So I do a logout , refresh the page and if have to reply,click on reply. After that again, logout and refresh.
    if things are fine than refresh works fine,sadly not quite often as it should be.
    Cheers
    Aman....
    PS: Are you on Oraclecommunity.net?

  • Problem with two-column layout

    Hello,
    I've done table-based layouts for several years, but I'm
    trying to switch to CSS. I still have a lot to learn...
    I'm trying to create a web site as a favor for a friend. She
    hasn't figured out what she wants yet, so I've just been creating
    some pages using canned designs. I created one using "Two-column
    left nav" under Dreamweaver's "Page designs (CSS)":
    http://www.alcie.org/demo2/
    I want a fixed-width left navigation column and a fluid
    content column.
    I ran into several problems with the original design. The
    most notible was that if I changed the browser window width, both
    the content and nav columns would resize. I didn't want that, so I
    set "navBar" width: 150px. That worked, but if I make the window
    too narrow, the content starts to overlap the navigation column in
    Firefox 1.5.0.6, and the navigation DIV drops to below the content
    in IE 7 rc (I think) 3 and IE6. I tried removing the width
    altogether, but that made things worse.
    What is wrong with this picture? Is there a cleaner way to
    solve my problem?
    Thanks.

    > Is there a cleaner way to solve my problem?
    Yes - dump that layout. It's too quirky. Go here and grab one
    http://www.maxdesign.com.au/presentation/page_layouts/
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Clean & Sober" <[email protected]>
    wrote in message
    news:edgvl4$akl$[email protected]..
    > Hello,
    >
    > I've done table-based layouts for several years, but I'm
    trying to switch
    > to
    > CSS. I still have a lot to learn...
    >
    > I'm trying to create a web site as a favor for a friend.
    She hasn't
    > figured
    > out what she wants yet, so I've just been creating some
    pages using canned
    > designs. I created one using "Two-column left nav" under
    Dreamweaver's
    > "Page
    > designs (CSS)":
    >
    >
    http://www.alcie.org/demo2/
    >
    > I want a fixed-width left navigation column and a fluid
    content column.
    >
    > I ran into several problems with the original design.
    The most notible
    > was
    > that if I changed the browser window width, both the
    content and nav
    > columns
    > would resize. I didn't want that, so I set "navBar"
    width: 150px. That
    > worked, but if I make the window too narrow, the content
    starts to overlap
    > the
    > navigation column in Firefox 1.5.0.6, and the navigation
    DIV drops to
    > below the
    > content in IE 7 rc (I think) 3 and IE6. I tried removing
    the width
    > altogether,
    > but that made things worse.
    >
    > What is wrong with this picture? Is there a cleaner way
    to solve my
    > problem?
    >
    > Thanks.
    >

  • Problem with two dynamic dropdowns

    I have four screens each one with two dropdown's in a child parent relationship with one constrained by the other. Both uses dynamic domains against entity views with the child passing a bind variable containing the value of the parent. The problem I am seeing is that when I enter the detail screen for a row then the child dropdown is populated correctly. When I leave the detail screen and return to the summary only rows with the same primary column value will have the secondary populated.
    e.g. Summary Screen
    Id | Department | Employee
    =========================
    1 | Finance | Jones
    2 | Finance | Smith
    3 | Engineering |
    4 | Engineering |
    5 | Admin |
    If I enter the detail form for the first row and change nothing but simply return to the summary, then rows 1 and 2 with primary 'Finance' will have employee populated but if I open row three with primary 'Engineering' then only rows 3 and 4 will have employee populated.
    It looks like the bind variable that limits the secondary dropdown values, gets set in the form view so that when you return to the table view only values from that limited set get displayed.
    (The differences between the four screens are related to fields other than the two dropdowns)
    Screen1 View for primary lookup:
    ==============
    Table name: Lookup
    Column1: CompositeId
    Column2: Description
    SQL:
    <pre>
    SELECT
    Lookup.Id,
    Lookup.Description
    FROM cv_claims.LOOKUP Lookup
    WHERE LookupName = 'screen_1'
    </pre>
    View for secondary lookup
    ================
    Table name: LookupAssociation
    Column1: FromLid
    Column1: ToLid
    SQL:
    <pre>
    SELECT
    Lookup.Key,
    Lookup.Description
    FROM LOOKUP Lookup
    WHERE Key IN (SELECT ToLid FROM LOOKUP_ASSOCIATION WHERE FromLid = ?)
    </pre>
    Bind variables: FromLid
    Bind variable in dynamic domain for screen 1
    =============================
    FromLid=#{bindings.S01EmployeeLid.inputValue}
    Any suggestions would be appreciated.
    Thanks,
    Pascal

    Hi Pascal,
    Did you follow the instructions in section 6.12.2 of the Oracle JHeadstart 10g for ADF (10.1.3.2) developer's guide?
    Regards,
    Ibrahim

  • Problem with two parallel While loops

    I have a serious problem with controlling two parallel While Loop. Here is the deal:
    I have written a VI to send a series of commands called Cycle through Serial Port to a custom hardware. One of these commands is setting motor pressure by sending it's command and changing it's voltage. After setting desired pressure I have to read and control motor pressure, again through serial port in a parallel loop. There is a Pressure Sensor in system and I can obtain current's motor pressure by sending a command and receiving pressure value. In the first While loop I send some commands to hardware including Pressure Setting Command trough a state machine. In the second While Loop I read pressure value and then decide to increase motor voltage or decrease  it. Now the problem is in communicating these two loops. In cycle after "Init" state when state reaches "Pressure 2 Bar" motor voltage will increase. Meanwhile I have to control this voltage in parallel While Loop. As you can see I used Local Variable to communicate between these two loops. The problem is that loops are not synchronized. Specially when I switch to "Pressure 3.8 Bar" state during cycle running control loop (second while) is still working based on "Pressure 2 Bar" state not 3.8 bar. Because of this motor pressure goes to 3.8 bar for a sec (becuase of  "Pressure 3.8 Bar" state) and comes back to 2 bar (because the second while still has not gotten that new state,most probably cause of all the delays in the loop)  and after couple seconds it goes back to 3.8 bar.
    I really don’t know what to do. Is there a way to fix this? Or I should consider a better way to do this?
    I went through Occurrence Palette but couldnt figure out how to embed that in the VI. 
    Sorry for my poor English. I attached VI and it's subVIs as a LLB file. I can explain more details if somebody wants. 
    Attachments:
    QuickStartCycle.llb ‏197 KB

    I make it a point to NEVER have a WAIT function inside a state machine.
    It sort of defeats the purpose, which I define as "Examine current state; decide whether you've met the conditions to advance to another state, then get out".
    For example, I have a single state machine VI controlling four identical instruments, via TCP connections.
    For some functions, that means issuing a command, waiting 60 seconds, then reading results.
    If I waited INSIDE the state machine, then it's tied up waiting on one device and cannot handle any others.
    Not a good plan.
    To handle this, I have a loop which calls the state machine.  After issuing the command, the state goes to "Waiting on Response", and there is a target time of 60 seconds from now.
    It's called over and over in that state, and each time merely compares NOW to the target time.  If NOW is past the target, then we read the results.
    the state machine can tell the caller when to call back; that's how I distinguish between an urgent need and nothing-to-do.
    By having the CALLER do the waiting, instead of the state machine itself, the state machine is free to handle another device, or do something else on the same device.
    You should be calling the state machine over and over and over anyway.  So, have the state machine "control the pressure" on every call, and THEN examine whatever state it's in.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Problem with nokia x6 back panel

    any body using nokia x6. is ur panel cover perfectly fit for ur phone?
    i got a problem with my back panel. i dont know what is the problem but i am unable to adjust the panel cover perfectly between camera lens and audio, charger jack.
    i went to the nokia care they told me that its the normal behaviour for every model. i bought it 2 days back and everybody is conveying the same message.
    can u help me please?

    mine fits perfectly ... you may have bought a fake or a reject ... ask to see another phone.
    do you get the same homescreen as shown in this nokia site ?

Maybe you are looking for

  • Masking Sensitive Data in SAP

    Hey Experts.  Can someone tell me how we can "Mask" certain data in SAP, using Standard functionality.  We don't want to customize, so if a way exists, please share. We want to be able to blank out or mask data such as the description of the WBS Elem

  • Dynamic loading tree and data grid

    Hi All, I new to java as well as JSF. I am very impressed with the jsf and Sun Java Creator IDE. I made a sample project. Now I want to load tree and data grid with dynamic values how can I achieve this. Please help to find out some examples. Also I

  • Personalization change font size

    Hi, i create new item using Personalization with Item Style Static Styled Text. I need to change font size. How to perform this. Thank you.

  • How to Disable OWA 2013 Mobile View

    Hi, I've the Exchange Servers 2013 CU6 at my environment. If I access OWA from mobile, default owa view is auto changed to narrow view. May I know how can I disable the OWA Mobile View and set all session to desktop view? Thanks & Regards, Nay Lin  N

  • Render text item with procedure call

    I have made several custom item types with custom attributes, and I use a procedure calls to render them in my region. For example, the pl/sql call from the item can look like: portal.write_text and I use p_id and p_text as attribute parameters. When