Need advice on what component(s) to use

I'm trying to put together a UI that displays a background image and displays on top of that image several jpanels, jlabels, and icon type images . I'd like the user to be able to drag the panels etc. to a desired location.
I'll then need to grab the coordinates and store them to a file, so that I can rebuild the UI with the components in the same place that they were placed when restarting the application
Wow that was hard to put into words.
The idea is the image will be a layout and the panels will be the physical position of a data source. A bit like in home automation programs that shows a layout of the house with the locations of cameras and switches etc.
So I'm thinking JInternalFrames may work but I need something that is transparent.
Any advice or a push in the right direction before I dive in will be greatly appreciated.
Edited by: xavier33 on Feb 22, 2008 4:08 PM

panels would work equally as well, but you're still going to have the same problem (from your first post)
"I'm trying to put together a UI that displays a background image and displays on top of that image several jpanels, jlabels, and icon type images ."
if any of the add-ons has a listener, you'll have to pass on the event to the panel.
this might be close enough - a small area at the top, when the cursor changes you can drag the panel around
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing
  int xPos, yPos;
  Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
  Cursor moveCursor = new Cursor(Cursor.MOVE_CURSOR);
  public void buildGUI()
    ImageBackgroundPanel backgroundImage = new ImageBackgroundPanel("test.gif");
    backgroundImage.setLayout(null);
    final JPanel viewPanel = new JPanel(new BorderLayout());
    viewPanel.setOpaque(false);
    viewPanel.setBounds(0,0,100,100);
    final JPanel p = new JPanel();
    p.setOpaque(false);
    p.setPreferredSize(new Dimension(viewPanel.getWidth(),10));
    viewPanel.add(p,BorderLayout.NORTH);
    viewPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));//<---just so you can see it moving
    backgroundImage.add(viewPanel);
    JFrame f = new JFrame();
    f.getContentPane().add(backgroundImage);
    f.setSize(600,400);
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
    p.addMouseListener(new MouseAdapter(){
      public void mousePressed(MouseEvent me){
        xPos = me.getX();
        yPos = me.getY();
      public void mouseEntered(MouseEvent me){
        p.setCursor(moveCursor);
      public void mouseExited(MouseEvent me){
        p.setCursor(normalCursor);
    p.addMouseMotionListener(new MouseMotionAdapter(){
      public void mouseDragged(MouseEvent me){
        Point vp_p = viewPanel.getLocation();
        Point me_p = me.getPoint();
        viewPanel.setLocation(vp_p.x + me_p.x - xPos,vp_p.y + me_p.y - yPos);
  public static void main(String[] args)
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        new Testing().buildGUI();
class ImageBackgroundPanel extends JPanel
  Image img;
  public ImageBackgroundPanel(String file)
    try
      img = javax.imageio.ImageIO.read(new java.net.URL(getClass().getResource(file), file));
    catch(Exception e){}//handled in paintComponent
  public void paintComponent(Graphics g)
    super.paintComponent(g);
    if(img != null) g.drawImage(img, 0,0,this.getWidth(),this.getHeight(),this);
}

Similar Messages

  • What component Should I use?, Jpanel doesn't work

    Hi
    I need a program that has a window that can go fullscreen and windowed (I did that with a Jframe in fullscreen mode with a jpnale and a 800x600 Jpanel and destroying them with an object that maneges them), I did it with a jframe that contained a Jpanel, I used a Jpanel to avoid the flickering on the screen but I also need to change the font type and the font size, but the setFont on the Jpanel doesn't change the font (as I have realized and also read here [http://forum.java.sun.com/thread.jspa?forumID=257&threadID=150588] ), so I'm lost, I might have to redo the whole thing, but I just wanted to know what component should I use for a window that is going to have custom graphics and need diffrent fonts and diffrent font sizes and work in fullscreen without flickering
    Thank you for your attention, I would aprecciate any help given

    for example:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JSlider;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class JPanelFont extends JPanel
      private Font font = getFont();
      private String myString = "Fubars Rule";
      private int fontSize = font.getSize();
      private JSlider slider = new JSlider(0, 100, fontSize);
      public JPanelFont()
        setPreferredSize(new Dimension(620, 250));
        setLayout(new BorderLayout());
        JPanel inputPanel = createInputPanel();
        add(inputPanel, BorderLayout.SOUTH);
      private JPanel createInputPanel()
        JPanel ip = new JPanel();
        slider.setMajorTickSpacing(20);
        slider.setMinorTickSpacing(5);
        slider.setPaintTicks(true);
        slider.setPaintLabels(true);
        ip.add(slider);
        slider.addChangeListener(new ChangeListener()
          public void stateChanged(ChangeEvent evt)
            fontSize = (Integer)slider.getValue();
            repaint();
        return ip;
      @Override
      protected void paintComponent(Graphics g)
        Graphics2D g2 = (Graphics2D)g;
        Object originalHint = g2.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        super.paintComponent(g2);
        myPaint(g2);
        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, originalHint);
      private void myPaint(Graphics2D g2)
        font = font.deriveFont(Font.BOLD, fontSize);
        g2.setFont(font);
        g2.drawString(myString, 20, 100);
      private static void createAndShowUI()
        JFrame frame = new JFrame("Dynamic JPanel Font");
        frame.getContentPane().add(new JPanelFont());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args)
        java.awt.EventQueue.invokeLater(new Runnable()
          public void run()
            createAndShowUI();
    }Edited by: Encephalopathic on May 21, 2008 9:18 PM

  • If we open a transaction i need to find what are the tables used

    hi gurus
    can anyone suggest me
    if we open a transaction  liek va01
    i need to find what are the tables used
    what are the fields used in that transaction
    i need a list .
    thanks&regards
    kals.

    Hi
    you can find all those details in transaction variant,
    go with SHD0 ( numerical 0) and then enter your transaction code and enter transaction variant name and then select that
    Select the program SAPMV45A and go CHANGE WITH PROCESSING (F6),
    there you can find the list of fields and field names.
    reward points if usful.
    thanks and regards,
    muralidhar

  • I need to know what Adobe version to use for my iPad to fill in and pay forms online

    I need to know what Adobe version to use for my iPad to fill in and pay bills online

    In the App Store search for Adobe Reader.

  • Hello friends, need advice on what PREPAID broadband (USB TYPE)(compatible) to use... I'm from the Phils, i use macbookpro macosxLION 10.7.2

    need advice/help

    my mbp (Leopard) used to work w prepaid wireless broadband (usb type) here in the phils... but when i upgraded my osx to LION... it dsnt any more... ds any1 have sol'n w this?

  • What component do I use to display image ????????

    hi there
    which component do i use to display image or pisture? JLabel?

    the most simple is a JLabel with an ImageIcon

  • How do I set up a wirelss music system with a MacBook Pro? Need advice on what to use: Bluetooth or AirPort. I don't have speakers yet. I listen mostly to classical music. Any advice on what kind of speakers?

    I live in a small apartment and would like speakers in the bedroom and the living room. I like the "all-in-one" units. Would two of these sound better than one in the living room? I have a wireless modem from my phone company, but I have not hooked it up yet. What is AirPort and is it necessary to do what I want to do?

    If your goal is to have a "whole home" audio experience, then using separate speakers in both the living room and bedroom would the proper approach.
    If you decide to go the AirPort Express Base Station (AX) route, then you would need a minimum of two of these devices; one each for each room. The AX is a wireless Internet router with built-in audio. The AX's audio port supports both analog and digital optical audio output and will work with either self-powered speakers or an audio receiver that supports either connection type.
    Classical music has very fine dynamics and, of course, the better the speaker, the better the sound reproduction. However, you don't need to go overboard as the AX is limited to the audio files that iTunes can play.

  • What Component should be used to display the list on UI

    Hi All,
    I have a table in which when the user selects a row and tries to remove the row. I am supposed to show the pop up which shows all the rows matching to the header of the row.
    In my backing bean i have the context of the row so i could extract the matching rows form db into a List<String> . Now what i need to know is which component on the Ui will show this as a list in Pop Up.
    I mean which component af:??? should be used to display the List ?
    I am kind of new to ADF.
    Regards,
    Sharma

    inputComboboxListOfValues
    selectOneChoice
    inputListOfValues

  • Need advice on what kind of report, queries to tune database slow issues

    Currently we have AWR reports. Our system is 11.1.07 version on AIX/Linux.
    Sometimes application will say it is slow running some queries.
    We have firewalls implemented so we cannot use toad, or other tools to access through our workstation.
    Any good manual suggestions to pinpoint what exact wrong in the system?
    Any good suggestions?
    Thanks in advance.

    846422 wrote:
    Any good suggestions?
    Try to forget for a moment the nice GUI tools and read instead what experts do when trying to answer "Why my database is slow ?" in http://www.nocoug.org/Journal/NoCOUG_Journal_201105.pdf.
    In your case I would try to work with end users to identify application scenarios that are slow and use SQL trace/TKPROF on related database sessions. For this you only need command line interface (CLI) access to run SQL statements and access to machine hosting database server: that should be possible with the jump server otherwise you cannot do anything and you would better ask someone that has CLI access to database and database server machine.
    If you have license to use AWR, you can also use ADDM report which runs an automatic analysis of AWR report and give some advices:
    SQL> @?/rdbms/admin/addmrptEdited by: P. Forstmann on 22 juil. 2011 20:15
    Edited by: P. Forstmann on 22 juil. 2011 20:40

  • Need advice on storing configuration variables for use by FP2000 Controller for embedded application.

    I am creating 8 machines that generally operate in the same way and each will be controlled using a FP-2000 controller. The only difference between the machines is a set of scaling constants and pass values for determining if the machine completed its process successfully.
    In the past, using an idependent PC and Labview, I have created a configuration.vi for writing the constants and configuration variables to a data file on my hard drive. Then in the auto.vi I read(only once each time the program is started) the file and store the data in the program. I would like to do something similar with this system but am not familar with the Field Point system.
    I know i
    t is probably not difficult to store the data to the host computer and transfer it to the modules but I am better off writing to the modules once and storing the data onboard the FP controller for use by an embedded application. This way, if the network connection is lost for any reason, the machine can still operate. Is this possible, and if not what do you suggest in order to prevent being so reliant on the host computer?
    Thank you for your help.

    Mike,
    There are a number of ways to accomplish what you desire. The easiest is to continue doing what you are already doing. The FP-20xx series modules treat their flash memory as if it was a hard drive, so the file I/O VI's in LabVIEW work just the same in a FP-20xx as on a regular computer running LabVIEW. The primary variation will be in how you write the files over the network. Since mapping network drives is more of a Windows functionality, you can not simply have a VI running on your host computer use a File I/O VI to write to a FP-20xx. Instead, what you will need to do is to write the file to you local drive and then FTP (file transfer protocol) the VI to the FP-20xx module. This can be done using the LabVIEW Internet toolkit or any 3rd party FTP util
    ity. One word of advice; the OS on the FP-20xx does not support long filenames but due to a problem in the FTP server, long filenames (non 8.3 compliant) may be uploaded and once there, you will be unable to access the file again, even to delete it.
    An alternative method that I have seen used is to use a global VI and write to it from the host machine through the use of VI server. You can then have the program on-board the FP-20xx save the globals to your configuration file.
    Regards,
    Aaron

  • Need advice on choosing laser printer for use w/Illustrator

    I know there are a few other threads out there on printers but I'm hoping to get answers specific to my situation. I need a laser printer that isn't astronomically priced and as big as a warehouse. Basically we send all our stuff to outside printers, but need a good printer for proofing our work. Currently using an HP 4200n supplied to us (4 artists) by our company. We'd like to get a printer just for the artists, which will give us better quality than this one which seems a basic office printer.
    We're also printing on basic office paper - what type paper would you recommend for graphics to look clean and sharp?
    Criteria are:
    1 - higher resolution - up to 1200dpi
    2 - color preferred but not necessary
    3 - wysiwyg so it will match what we're doing on screen (95% of our work is grayscale graphics)
    4 - not so costly the company will refuse to purchase for us (initial cost and supplies)
    Thanks to all who reply - also like to hear what to stay away from.

    To Jacob's advice, I would add...
    1. If you have the choice between genuine Adobe PostScript and a third-party emulation, go for the former. Unfortunately, this will cost you more money.
    2. Unless you are dealing only with small-sized printed pieces -- that is to say, smaller than letter-size -- you really need to consider a large-format (e.g., tabloid size) laser. If your laser maxes out at letter-size (or legal-size) and your printed piece trims to letter-size, you'll need to reduce output to print out things like spreads, bleeds, printer's marks, etc. And if you can't proof at 100 percent (i.e., actual size), that's a huge disadvantage. Yes, you could print things out in sections and tape them together, but that will get old fast. Unfortunately, a tabloid-size PostScript laser will really set you back some bucks... not to mention some serious desktop real estate.
    If you are budget-constrained, you should probably not rule out inkjet options.

  • Need advice on what to look for when buying an external HD

    Hello iBook enthusiasts,
    I want to buy an external HD for backing up my important documents, and for having a way of booting up just in case the iBook should fail. I have searched some of the old posts, but I am still a bit confused.
    So far, it seems that the most important criterion is that the drive have FireWire in order to be bootable.
    I don't want to spend a ton of money. Somehow, I get these emails from Buy.com, advertising their specials. For example, they had a 250G one for $100 (although that particular deal is now expired). This seems like a good deal to me. Is that right? Should I try to buy the largest or smallest one that's in my price range? If iBook does die, I would like to still be able to use the HD with whatever replacement I get.
    Also, is there any particular brand that I should either look for or avoid? How do I know these things?
    Anyway, sorry these questions are so vague. Thanks in advance for any advice.
    Anna
    Ibook G3 500 MHz   Mac OS X (10.3.9)   14 GB HD, 640 MB RAM

    Anna:
    Yes, rule no. 1, Firewire or FW/USB
    2. Largest HDD you can afford (having more space than you need it not a problem; needing more space than you have, is.)
    3. 7200 rpms. (Most of them are, but not all)
    Here is a list of some of the best buys already sorted for 200-300 GB.
    Different folks like different manufacturers. I have had my LaCie for 2 years. No problems. I like it for it's compact size and elegance.
    Here are some good hints from Dr. Smoke on Backup and Recovery. Instead of Retropect, which I could never quite figure out, I use Carbon Copy Cloner or SuperDuper.
    Post back with further questions or comments.
    Good luck.
    cornelius
    Message was edited by: cornelius

  • Need advice on graffics card upgrade for use of CS6 Mercury Playback in PR & AE w/ dell xps 9100

    I am curretly running CS6 on my dell xps 9100
    Windows 7 64bit
    12GB Ram
    2TB HD + 0 Rate 2TB External Drive (x2)
    Intel Core i7 930 operating at 2.8 gigahertz with an 8-megabyte cache.
      Memory and Storage  
    The Studio XPS 9100 can be equipped with up to 24 gigabytes of RAM. It uses Tri-Channel DDR3 SDRAM operating at 1333 megahertz. The computer has six DIMMs into which RAM can be plugged. The Studio XPS 9100 may have a hard disk size of up to 2000 gigabytes using SATA drives operating at 7200 rpm.
    Video
    ATI Radeon HD5870 with 1024 megabytes of RAM
      Expansion and Networking  
    The Studio XPS 9100 has one PCI slot, three PCIe x1 slots, one PCIe x8 slot and one PCIe X16 slot. It has four USB 2.0 ports, a 15-in-1 card reader, a headphone port and a microphone port on the front panel. The rear ports into an IEEE 1394a port, surround-sound audio ports, four USB 2.0 ports, one eSATA port, an S/PDIF port and HDMI ports. It has integrated 10/100/1000 Gigabit LAN through the RJ45 port on the back with optional internal Wireless-N. PCI card slot (PCI_1) 26
    PCI Express x1 card slot (PCIE1X3)
    PCI Express x16 card slot (PCIE16_1)
    PCI Express x1 card slot (PCIE1X2)
    PCI Express x1 card slot (PCIE1X1)
    PCI Express x8 card slot (PCIE8_2)
      Chassis and Power  
    The Studio XPS 9100 is 19.4 inches high by 7.8 inches wide by 20.7 inches deep. It weighs about 40 pounds. A 525-watt power supply powers the computer.
    I use Audition, Premiere Pro and After Effects (Dynamic Link) to edit concerts filmed on 4 HD Camera's (m2ts x3 and mp4) I also take and mix 6-8 tracks from soundboard and mix in audition. I find my system is struggling to keep up when I have done some color correction and then try to cut in multi-cam mode. My graphics card does not support CUDA and as stated above my system only has a 525w power supply. So a GeForce GTX 470, 570, 580 would not be compatable. I do not GAME but I work with large HD files (4 angles, 1-2 hours each, audio & effects).
    My trouble is I don't know which one of the graffics cards that support Mercury play back, would be the best for my needs without having to upgrade my power source (if possable). I'm thinking a mid level card and another 8-12 ram upgrade would be more suited (and cheaper) to my needs, unless I'm going to need a power upgrade anyway. If someone could please let me know what card would help me with my worload of these that would be great! I guess what Im saying is can someone tell me which of these is compatable with my system and is it worth it for the change in performance I will see?
    GeForce GTX 285 (Windows and Mac OS)
    GeForce GTX 470 (Windows)
    GeForce GTX 570 (Windows)
    GeForce GTX 580 (Windows)
    NVIDIA® Tesla C2075 card (Windows) when paired with a Quadro card as part of an NVIDIA Maximus™ configuration
    Quadro FX 3700M (Windows)
    Quadro FX 3800 (Windows)
    Quadro FX 3800M (Windows)
    Quadro FX 4800 (Windows and Mac OS)
    Quadro FX 5800 (Windows)
    Quadro 2000 (Windows)
    Quadro 2000D (Windows)
    Quadro 2000M (Windows)
    Quadro 3000M (Windows)
    Quadro 4000 (Windows and Mac OS)
    Quadro 4000M (Windows)
    Quadro 5000 (Windows)
    Quadro 5000M (Windows)
    Quadro 5010M (Windows)
    Quadro 6000 (Windows)
    Quadro CX (Windows)
    Tesla C2075** (Windows)

    Right now I can get a 570 for 175 bucks... R4yMoNd. When I look at the 570 in comparison  to what I have it doesnt look as though itis going to make too much difference. http://www.hwcompare.com/9048/geforce-gtx-570-vs-radeon-hd-5870/ I'm sure however the CUDA cores will speed it right up. I'm no good when it comes to all that so thanks to both you for the help. I have tracked down a 670 in stock (seems tough) for $440 then I need a 700 w power supply for about 70. If the 570 should take care of the problems listed above thats what I'm going for.. Just wasnt sure if it would make the needed difference

  • Need advice on what to purchase:FCE,iMovie09,Soundtrack,Garageband.

    Deciding best purchases.I am attracted to moving up, seeking a better visual experience for editing. Looking at Final Cut express, Soundtrack, Garageband, ilife09 with iMovie09. The more I read the more confusing it is. I am often lining up educational audio to video for hiqual pro product (voiceover mixed with 1 track of music-usually only 2 track audio). I am experienced somewhat in Audacity. I might need noise clean later. With multi versions out there and changes to stuff (this dropped this added) what should I do. This all started because I was told I should/could be using garageband instead of Audacity and then importing my iMovie06 into it. But then I can't export it back as project tro iMovie06 I think. I was told move up to iMovie09 since FCE is too complicated for now. But it appears FCE allows visual tie in of audio and video but then I don't know what version of FCE to get (Soundtrack was dropped form latest version FCE). Do I still need to use garageband with FCE for audio editing?

    +" ... Do I still need to use garageband with FCE for audio editing? ..."+
    It depends on what you need to do. Audio can be edited in FCE, which includes a good set of audio filters & effects. I've done some pretty extensive audio editing in FCE and even when I did have SoundTrack I never used it. If you're adding voiceovers or additional audio tracks then I'd say FCE can do what you need and you don't need an external audio editor. (Except perhaps for sound cleaning, for which I suggest SoundSoap.)
    Overall, I'd suggest spelling out exactly what kind of video & audio editing you think you need or want to do. Then with those requirements you can figure out which software is best suited to your needs.

  • Need advice on what do with new motherboard :(

    Back in January I ordered a P67-GD53 MSI motherboard from this company - www.ncix.com
    I installed the motherboard and drivers, things were working fine, until I noticed windows 7 would not boot up
    sometimes, It would hang at the welcome screen. The problem kept getting worse, until I could not boot up at all.
    i took my tower into a company called "Microbytes" which did a diagnosis. They said the "hard drive controller" on the motherboard was defective.
    Should I RMA the store I bought the motherboard from, or directly from MSI ??
    AND I realize the motherboard I bought is defective - the SATA 3Gbs port will be replaced by Intel eventually. If I RMA this motherboard now,
    does that mean I'll just end up getting a new defective motherboard ??
    Thanks for the advice....this is my first MSI motherboard, and it will be my last. I've never had these issues with Evga or Asus.  :(

    Quote
    this is my first MSI motherboard, and it will be my last. I've never had these issues with Evga or Asus.
    Keep such useless comments to yourself.  EVGA and ASUS have RMA departmens, too.  Also, how can you be sure that the board wasn't damaged during handling/shipping or because of electrical problems (statical surge)?
    Quote
    i took my tower into a company called "Microbytes" which did a diagnosis. They said the "hard drive controller" on the motherboard was defective.
    Based on what testing methods did they come to this diagnosis?
    Quote
    I installed the motherboard and drivers, things were working fine, until I noticed windows 7 would not boot up
    Did you put one a fresh installation of Windows 7?  Or did you take an old installation from another system?
    Quote
    It would hang at the welcome screen. The problem kept getting worse, until I could not boot up at all.
    "Not boot up at all" means what? Where did the system hang? Any error messages?
    What BIOS/EUFI Version are you using and what else is in your system?  Please provide full system specifications! ---> >>Posting Guide<<

Maybe you are looking for