Return new Dimension within getPreferredSize() causing trouble

attempting to compile this causes this problem:
C:\tryjava>javac SelfContainedPanel.java
SelfContainedPanel.java:44: missing method body, or declare abstract
public Dimension getPreferredSize();
^
SelfContainedPanel.java:46: return outside method
return new Dimension(150,100);
^
2 errors
When I comment out the getPreferredSize method, the size is all wrong, basically 2 pixels x 2 pixels....
I studied the Dimension API and the getPreferredSize method but it seems as if I'm doing things correctly??
//CODE
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SelfContainedPanel extends JPanel {
     private int x1,y1,x2,y2;
     public SelfContainedPanel()
          addMouseListener(
               new MouseAdapter() {
                    public void mousePressed(MouseEvent e)
                         x1 = e.getX();
                         y1 = e.getY();
                    public void mouseReleased(MouseEvent e)
                         x2 = e.getX();
                         y2 = e.getY();
                         repaint();
          addMouseMotionListener(
               new MouseMotionAdapter() {
                    public void mouseDragged(MouseEvent e)
                         x2 = e.getX();
                         y2 = e.getY();
                         repaint();
     public Dimension getPreferredSize();
          return new Dimension(150,100);
     public void paintComponent ( Graphics g)
          super.paintComponent(g);
          g.drawOval(Math.min(x1,x2),Math.min(y1,y2), Math.abs(x1 - x2), Math.abs(y1-y2) );
}

Here is the code re-posted correctly. I apologize for my hasty remarks.
//Fig 13.3 SelfContainedPanel.java
// A self-contained JPanel class that handles its own mouse events
//package com.deitel.jhtp3.ch13;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SelfContainedPanel extends JPanel {
     private int x1,y1,x2,y2;
     public SelfContainedPanel()
          addMouseListener(
               new MouseAdapter() {
                    public void mousePressed(MouseEvent e)
                         x1 = e.getX();
                         y1 = e.getY();
                    public void mouseReleased(MouseEvent e)
                         x2 = e.getX();
                         y2 = e.getY();
                         repaint();
          addMouseMotionListener(
               new MouseMotionAdapter() {
                    public void mouseDragged(MouseEvent e)
                         x2 = e.getX();
                         y2 = e.getY();
                         repaint();
     public Dimension getPreferredSize();
          return new Dimension(150,100);
     public void paintComponent ( Graphics g)
          super.paintComponent(g);
          g.drawOval(Math.min(x1,x2),Math.min(y1,y2), Math.abs(x1 - x2), Math.abs(y1-y2) );
}

Similar Messages

  • How to add a new dimension in ASO cube without losing all data

    Hi,
    I have an ASO cube with 18 dimensions and I want to add a new one (regular). When I add this new dimension it asked me that the all data has to cleared before the restructure can take place. If I click yes then I would lose all data regardless of the fact if I have a level0 export or not. Because when I tried to reload the export back into the cube it gave me an error cause all the dimensions were not present in the export. Does anyone know how would I be able to accomplish this task?
    Thanks
    fikes

    You can try this work around solution.
    1) Export Lev0 data
    2) Clear the cube
    3) Add new dimension Regular.
    4) Add a default member Reg00 in the new dimension and save.
    5) Open the Lev0 data in a text editor, Insert "Reg00" in the begining of the file and Enter.
    6) Lev0 file will have first record "Reg00" and the remaining export file will be from the second record.
    7) Load the modified file with out rule file.
    You can verify that all your history data will be loaded w.r.to the Reg00 of the New dimension Regular.

  • How can I start a new paragraph within the same table cell?

    In Numbers, when adding text within a table frame, how can I start a new line within the same frame (rather than advancing to the next cell)?  I'd like to enter a mini-list of several items of various lengths of data.

    While Wayne's answer solves your problem, another possibility is to uncheck the box at the bottom of the Table inspector for "Return key moves to next cell." If that is unchecked, the return key types a paragraph return within the cell (the same as Option Return with the box checked).
    With that box unchecked, Shift Return types a soft return (new line without a paragraph break).

  • Addine New Dimension In An Existing Cube

    Hi fellows,
    Im not an expert so need you feedback.
    I am supporting a cube that was built a decade ago using Essbase 6.5. It has 7 dimensions (3 dense, 4 sparse). With the new reporting requirement, I need to add a new dimension to be called "BaseTimePeriod" that seems like a Time dimension but will show the "Constant Dollar" amount calcuation for difference Scenarios.
    Since the cube has been there for so long, and the expert that has pioneered that cube is no longer in the company. All of our reports uses API being called in MS Excel to retrieve data from the cube and format it the way the users wanted it to be. As well as 75% of our data are user input using the Essbase Excel Add-in, "lock/send" commands.
    My problem now is that, since I need to introduce another dimension for the "Constant Dollar" calculation, is there any way that if I add a new dimension the existing process of uploading data by the users as well as retrieving data through Excel API will not be affected?
    I tried to add new dimension in the R&D server that we have when I try to retrieve historical data from the cube in the Excel since there is "BaseTimePeriod" dimension before, the Excel report layout gets affected and inserts a new row placing "BaseTimePeriod" in that cell since this not yet there before. And when I try to upload data through Excel Add-in "lock/send" action, it did allow me unless I put a member from the "BaseTimePeriod" to complete the dimension member combination.
    My questions now are:
    1) How can I add a new dimension without impact from the historical data?
    2) Is there any way to place a default value for the new dimension for the historical data so it would complete the dimension member combination, so whenever I retrieve and upload data there will be no problem?
    Any insights related to this questions is highly appreciated. Thanks!
    obelisk

    I tried to add new dimension in the R&D server that
    we have when I try to retrieve historical data from
    the cube in the Excel since there is "BaseTimePeriod"
    dimension before, the Excel report layout gets
    affected and inserts a new row placing
    "BaseTimePeriod" in that cell since this not yet
    there before. And when I try to upload data through
    Excel Add-in "lock/send" action, it did allow me
    unless I put a member from the "BaseTimePeriod" to
    complete the dimension member combination.Essbase must have all (non-attribute) dimensions represented for any data operation to happen. If you think about it, each cell of data represents the intersection of exactly 1 member from each dimension and, behind the scenes, the storage mechanisms are focused on optimizing those relationships. Thus, you can see how the BaseTimePeriod member got added to your retrieve as Essbase didn't know which member from BaseTimePeriod you wanted and made the assumption that you wanted the dimension level member. If you place that dimension level member into your retrieve range (along side any of the other "page" (i.e. filter) fields, the retrieve will not insert a row. The insertion of the row can be extremely hazardous as it pushes the other rows down by one; your end users may be making decisions that effect the existence of your company based on formulas reading those cells and, effectively, the formulas may be referencing data from the wrong row..
    My questions now are:
    1) How can I add a new dimension without impact from
    the historical data?Although my forte is not cube design (I work mostly with frontends to Essbase), most situations I have seen when this happens the historical data is assigned a distinct member within the new dimension (assuming you aren't going to go back and reload the data from the sources and map the data based on the new dimension's values in the dataset.
    2) Is there any way to place a default value for the
    new dimension for the historical data so it would
    complete the dimension member combination, so
    whenever I retrieve and upload data there will be no
    problem?As stated above, put a member from the dimension, most likely the dimension member itself, into the existing Excel templates.
    Good Luck!
    Tim Tow
    Applied OLAP, Inc

  • Can My New Hard Drive Be Causing BackUp Weirdness?

    Last week, I bought a new Seagate 100GB/7200 rpm HD, which I've been using externally in a Firewire enclosure. I wanted to try it out for a week before I install it into my Pismo.
    I've been using computers for 20 years, and I'm conscientious about saving often, and backing up everyday. Here's the weirdness: Today, Saturday Oct 6, I opened the two files I've been using every day, only to find I'd lost two day's work. I checked the Last Modified date, and sure enough, both files were marked Wednesday, Oct 3. So, I checked my internal HD to which I've also been saving my work. Same thing. Both files marked Wednesday. So I checked my memory stick. Same thing. Both files marked Wednesday. These are Word files. (I also usually have iTunes and Safari running in the background).
    The most likely explanation for this is no doubt user error of an all too common kind but I am, as I say, extremely careful about backing up. So today, when I'd finished, I saved both files, and closed both files. I checked them in the HD's list, and they were both marked with today's date. Fine. So I clicked and dragged the first one over to the folder in the Internatl Drive. No problem. It alerted me that there was an older version and did I want to change it. I did. That went fine. But then, with the second file (also marked Today), when I dragged it to the Internal Drive's folder I fumbled it slightly, and I got a message saying "THere is a NEWER file with that name in this location." Huh? Sure enough, the file in my target folder was marked Today, and now the source file was marked Wednesday again!
    The order I've been saving things is first to the new external HD, then to the internal HD, then to the memory stick (although I only used the stick on Friday).
    First question. Is it possible there is something wrong with the new HD that would cause this? I don't want to install this puppy if that's the case. In fact, I'd want to return it.
    Second question. If I've saved a file but haven't closed it, and then drag its icon from the HD to another target, will I be making a copy of the latest saved version? Or only the latest CLOSED version? (I don't think I did this yesterday, but it's possible, I guess).
    Third question. Even if it is human error, what error could I possibly have made that would lose TWO days work and not just one?
    Thanks for any light you can shed on this.

    Disregard last post--I reread your message and see I got it wrong. The internal drive was set to Master. So, after reading your input, and checking Seagate's site (for the new drive) and Toshiba's (for the old), and OWC's Help Desk (for the Firewire enclosure) I've set the new drive to Master and put it into the machine. I've left the old drive on Master and put it into the enclosure to be used occasionally as an external backup. These seem to be the correct settings for both locations. I've now re-initialized the new drive and I'm up and running with it. I'm expecting this will have solved the problem. If not, I'll post back. Thanks so much for your help--others in the G3 Powerbook forum also found it very helpful. All best, GB.

  • Can My New Hard Drive Be Causing Back-Up Weirdness?

    Last week, I bought a new Seagate 100GB/7200 rpm HD, which I've been using externally in a Firewire enclosure. I wanted to try it out for a week before I install it into my Pismo.
    I've been using computers for 20 years, and I'm conscientious about saving often, and backing up everyday. Here's the weirdness: Today, Saturday Oct 6, I opened the two files I've been using every day, only to find I'd lost two day's work. I checked the Last Modified date, and sure enough, both files were marked Wednesday, Oct 3. So, I checked my internal HD to which I've also been saving my work. Same thing. Both files marked Wednesday. So I checked my memory stick. Same thing. Both files marked Wednesday.
    The most likely explanation for this is no doubt user error of an all too common kind but I am, as I say, extremely careful about backing up. So today, when I'd finished, I saved both files, and closed both files. I checked them in the HD's list, and they were both marked with today's date. Fine. So I clicked and dragged the first one over to the folder in the Internatl Drive. No problem. It alerted me that there was an older version and did I want to change it. I did. That went fine. But then, with the second file (also marked Today), when I dragged it to the Internal Drive's folder I fumbled it slightly, and I got a message saying "THere is a NEWER file with that name in this location." Huh? Sure enough, the file in my target folder was marked Today, and now the source file was marked Wednesday again!
    The order I've been saving things is first to the new external HD, then to the internal HD, then to the memory stick (although I only used the stick on Friday).
    First question. Is it possible there is something wrong with the new HD that would cause this? I don't want to install this puppy if that's the case. In fact, I'd want to return it.
    Second question. If I've saved a file but haven't closed it, and then drag its icon from the HD to another target, will I be making a copy of the latest saved version? Or only the latest CLOSED version? (I don't think I did this yesterday, but it's possible, I guess).
    Third question. Even if it is human error, what error could I possibly have made that would lose TWO days work and not just one?
    Thanks for any light you can shed on this.

    Thanks JPL. At least now I know I'm not going mad. The drive really did undo what I saved. I watched it happen again on the weekend (but this time I'd emailed the work to my Yahoo account before I copied it in any direction). But it's still pretty unnerving to see it happen.
    What you say accords perfectly with what I've been reading on the Panther forum and elsewhere. I didn't know anything about jumper settings. I looked up Toshiba (re the old drive) and Seagate (for the new drive) on the subject. Both are remarkably confusing. Toshiba's settings are dependent on whether "Pin 28" is High or Low, but they don't explain what this means, nor which pin is 28. Seagate's illustrations do not resemble my new drive and they contradict what is shown on the label.
    Unfortunately, I went ahead and put the new drive into the machine set to Cable Select. And re-did the whole SuperDuper process. But after reading the above sites, I decided it should probably be set to Master. So I opened up the Pismo again and reset it (that only took about 5 minutes). I am just now completing the SuperDuper process again.
    I also checked OWC's Help Desk and you're right--they say, "All drives should be set to Master when used in a FireWire case. If it is a dual enclosure then one is set to Master and the other Slave."
    So it seems all this rigmarole stems from the HD having shipped set to Cable Select, since both the Enclosure and the Pismo want it set to Master.
    Clarification: do you mean I should now re-initialize the old HD which I've now put into the Firewire enclosure? I haven't changed its jumper settings. I'd like to avoid SuperDupering again, if possible, as it takes over an hour. Wouldn't I just be cloning from the clone I just made?

  • HT6114 my audio is being funny on my mac. It is brand new, and hasn't had trouble since this update. It gets stuck at full blast with a / though it. then no audio comes out. Once I turn it off it fixes it self thouhg.

    my audio is being funny on my mac. It is brand new, and hasn't had trouble since this update. It gets stuck at full blast with a / though it. then no audio comes out. Once I turn it off it fixes it self thouhgh, or if I wait a while it finally fixes it's self. If this happening to anyone else?

    I don't think that is normal behavior. The long press is possibly causing the system to force power down, which would then allow it to power back up.
    Just to make sure, all drivers are up-to-date? Are there pending BIOS updates? If so, you'll want to make sure it can restart properly before applying the BIOS update
    Try an Ubuntu LiveUSB or LiveCD to rule out software issues.
    If that doesn't work, try taking out the battery and AC, pressing the power button ten times, then holding it for ten. This is usually the remedy for another issue, but try it anyway.
    If that doesn't work, then try resetting the BIOS settings. Then try unplugging the CMOS battery overnight. Otherwise, might have to call for warranty.
    W520: i7-2720QM, Q2000M at 1080/688/1376, 21GB RAM, 500GB + 750GB HDD, FHD screen
    X61T: L7500, 3GB RAM, 500GB HDD, XGA screen, Ultrabase
    Y3P: 5Y70, 8GB RAM, 256GB SSD, QHD+ screen

  • New dimensions not appearing in erpi

    Hi,
    I am using erpi version 11.1.2.1 with e-business 12 and Hyperion Planning. We added 2 new dimensions in epma for the planning application and successfully deployed. I have refreshed the metadata within erpi but the new dimensions are not appearing in the target application page and so these cannot be mapped from e-business. The admin guide says a refresh of the metadata synchronises erpi and the app. The refresh does not appear to be failing.
    Can erpi recognise new dimensions in Planning?
    Thanks,
    Nathan

    My colleague tried and it worked. My laptop was intermittedly losing connectivity so we put it down to that. Glad the erpi does sync dimensions from planning!
    Thanks,
    Nathan

  • New dimension created not coming in workbench

    Hi All,
    I had created a new dimension last week, but I am not able to see the same coming up in "Dimension Ordering" in Endeca Workbench even after running workbench.
    I can see the same in Endeca JSPref application. This is the first time we are not able to see a dimension in workbench.
    I cannot see the same in "dval_ranks.xml" as well which I downloaded as part of Instance configuration.
    When I run initialize services, then only the dimension comes up in Endeca workbench.
    Please can you help me out in getting the issue resolved without running initialize services. Also it would be great if there is root cause for the same.
    Regards,
    Japneet

    You need to run a command called "update_web_studio_config.bat" (or .sh) in order to tell Workbench about the new dimensions.  It never really made sense why this was necessary (since part of the baseline update script performs something like setPostForgeDimensions), but it is necessary.
    Note that people can't be in Workbench when this occurs as it requires locks.

  • Create new dimension on top of SAP BW data

    Hi expert,
    I'm having a problem to create a new dimension on top on SAP BW data. I have a dimension details object called 'L01 G/L Account Key'. When I drag this object to the result object in the web intelligence, it display full data like '1000/30100'. How can I trim the data so it shows '30100'?.Is there any formula that support in universe?
    I don't want to do the formula inside the web intelligence report because I want to use this dimension to other reports as well.
    Please expert....help me!
    Thanks & Regards,
    Syahida-

    Hi,
    SAP BW MDX does not support calculations that return string or date: this is a limitation of SAP BW OLAP engine.
    By the way I found exceptions that satisfy your requirement.
    For instance you can manipulate a substring of a dimension only with NAME and UNIQUENAME attributes.
    Example, you can use these expressions:
    <EXPRESSION>right([OD_COUNTRY].currentmember.name, 4)</EXPRESSION>
    <EXPRESSION>right([OD_COUNTRY].currentmember.uniquename, 4)</EXPRESSION>
    <EXPRESSION>left([OD_COUNTRY].currentmember.name, 4)</EXPRESSION>
    <EXPRESSION>left([OD_COUNTRY].currentmember.uniquename, 4)</EXPRESSION>
    <EXPRESSION>mid([OD_COUNTRY].currentmember.uniquename, 2,4)</EXPRESSION>
    Regards
    Didier

  • Which Ipod Updater was causing trouble with ipods??

    I read a while back that there was an ipod updater that was actually making the ipod not work can anyone tell me which updater this was?

    I updated my ipod video w/ that ipod updater that causes trouble is there a way for me to switch back to the previous update because now the ipod plays the first 2 sec. of a song and then shuffles through the rest of the songs not allowing me listen to my downloaded music. Please help w/ my concern or let me know if there is a newer updater that will work for me.

  • Error while creating a new Dimension/Model in BPC 10.0 NW

    Hello Experts,
    I am using BPC 10.0 NW system.
    When I try to create new Dimensions or Models I get the following Error Message.
    "Error in Admin module or a component used by Admin module.
    Failed to create SAP NetWeaver BI InfoObject for dimension."
    I am assigned to all the needed task profiles to create Dimensions and Models.
    Please assist me to resolve this issue.
    Thanks & Regards,
    Archana

    Thanks Roberto.
    The error was coming because while creating the user id "SAP_ALL" Profile was not assigned. So I was not able to create Dimensions and models.
    Now the issue is solved.

  • Adding a New Dimension to a CUBE

    Hello
    Being in new at Oracle OLAP...
    If I need to add a new dimension, SHOULD I RECREATE the cube entirely again??
    Is not there any other way??
    Regards

    Each cell in a cube is referenced by a dimension. Think of it as pointers to cells in a multi-dimensional array.
    So when you add or remove a dimension, what should happen to all those cells.
    In a way you are breaking the cube.
    Since cube data is loaded from a table, you can always re-load your cube after adding or removing a dimension.
    Dimensions are not added/removed frequently, once the design is finalized. You may add a new hierarchy to existing dimensions, which is done more frequently compared to adding a dimension. After adding a new hierarchy, you just have to re-aggregate cube data and not re-load from relational source.
    Cubes are created for reporting, and can be deleted/recreated or truncated - monthly, quarterly or yearly - for various reasons.
    Your source transactional detailed data should be in one (or more) fact tables and should never be deleted.
    Is there any "operational" concern in a Production environment, because of which you are asking this question?
    One trick could be: to create the new cube (with more dimensions or less dimensions than the original cube) and then COPY DATA from original cube into that new cube.
    But it may take the same amount of time as re-loading the new cube from the relational source.

  • New Dimension to a Cube

    Hi,
    We've a cube already in production (with huge amount of data). Now we have to add few more 'new' characteristics to this cube.
    My question is, can I create new Dimension and add characteristics to this without deleting data?
    As the characteristics are new, we don't have to care about reloading the cube as data for these new characteristics don't exist.
    Can it be done? Any thoughts?
    Regards,
    Vikrant.

    Hello,
    If you had a new characteristic to an existing dimension you don't have to delete data. I already done that procedure many times.
    This can help you too:
    From this weblog:
    Remodeling in NW BI 2004s
    "In BW 3.5 version, if data is present in an infoprovider, we can add an infoobject to it, but we cannot delete or replace an existing infoobject in it, unless all infoprovider data is deleted.
    This problem has been overcome in BI 2004s version, where the concept of 'Remodeling' can be used to change the structure of an infoprovider even while it holds data."
    Ok, so, in version BW3.X and BI7 you can add a new characteristic to an existing dimension, but you have more options in BI7. If you want to had a new dimension you have to delete all data.
    Regards,
    Jorge Diogo

  • Not possible to open/create a new connection within BT manager on Satellite M40

    Bluetooh manager is open and present in system bar.
    However it is never possible to open/create a new connection within bluetooth manager as it always say "bluetooh is not ready". Troubleshooting is required but no clear indication is available; button for wireless link is active and I am able to have wifi internet access at the same time.
    It is never possible to open access to a PDA or mobile phone for file transfer through bluetooth.
    Do i have to reload completely the bluetooth stack or is there another way to troubleshoot the bluetooh system?
    Thanks you for replying if possible.

    Remove the Bluetooth Monitor software if it is installed. Download the latest BT-stack v5.10.06 here:
    http://aps.toshiba-tro.de/bluetooth/redirect.php?page=pages/download.php
    and install it. Ensure that the wireless switch is turned on and the suitable antenna is selected.
    Press Fn+F8 key to select BT antenna. Selection menu only appears if WLAN and BT is inside.
    Read the following if you should still have some problems:
    http://aps.toshiba-tro.de/bluetooth/redirect.php?page=pages/faq/bluetoothnotworking.html

Maybe you are looking for

  • Issue while loading crystal Report.

    Hi , Crystal report is getting loaded properly in the VS Viewer for Crystal report when we preview the report but when the same report is being loaded through application then following errors are being displayed: 1) "Object reference not set to an i

  • How do I get photos from iPhoto to my new computer?

    I have a new MacBook Pro and I am using the copy-paste method of getting data from my exteranl hard drive to the new computer. I am doing this rather than using the migration assistant to avoid putting any corrupt files on the new MacBook Pro. My pro

  • EAP-TLS on ACS v4 for wireless users

    Hi, I?m trying to deploy EAP-TLS authentication method on ACS v4.0 for my local wireless users; really I stuck with the certificate issue and need your assistance to understand the required procedures to accomplish the task. As mentioned on the ACS c

  • I can't see icloud in my preference system it's mobile me icon instead

    i can't see the icloud icon in system preferences it's mobile me instead how can i figure icloud

  • Lenovo G580(20157​) usb boot not working after windows 8 installati​on

    Hi, I have lenovo G580 (20157) model. previously i had installed Windows 7 and Ubuntu 12.04 with no problem. Today i decided to go for windows 8.1. it installed perfectally without any issue ( Legacy mode non UEFI ) and working fine but ubuntu live U