Minor bug in portal's tutorial

Hi all,
in portal tutorial (portalApp/tutorial/portlets/login/header.jsp),
the "new Java style code string test":
if ( username == "" ) {
Have fun!

Hi all,
in portal tutorial (portalApp/tutorial/portlets/login/header.jsp),
the "new Java style code string test":
if ( username == "" ) {
Have fun!

Similar Messages

  • Cluster VI Reference Minor Bug

    Over on LAVA PJM_labview posted a video of a bug found in LabVIEW 2013 SP1.  It is a minor bug with the block diagram when showing a cluster constant with a VI reference constant in it.  Here is the video of how to reproduce the bug.
    http://screencast.com/t/gfKwlvMcCsHI
    And here is the original thread on LAVA.
    http://lavag.org/topic/18297-cool-little-lv-2013-sp1-bug/#entry109757
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

    I played with this and filed it as a CAR (#479432). Intriguingly, there are a couple workarounds:
    Option 1
    On block diagram:
    1. Create cluster constant containing refnum with auto-sizing set as arranged (vertical or horizontal)
    2. Create typedef
    3. Unlink from type def
    4. Change auto-sizing to desired value
    5. Recreate typedef
    Option 2
    On front panel:
    1. Create cluster containing refnum control
    2. Create typedef
    On block diagram:
    3. Create constant from cluster typedef on block diagram.
    4. Unlink constant from typedef, change auto-sizing as desired, recreate typedef
    Christopher S. | Applications Engineer
    Certified LabVIEW Developer
    "If in doubt... flat out." - Colin McRae

  • Y2K bug in portal

    Hello,
    It looks that we found some date bug in portal reports.
    Problem appear in QBE report when I'm trying to show date: 01-01-0001 (yes first year of Jesus life)..
    Portal is showing 01-01-2001 (add 2000 years)
    the some date selected from table via sqlplus give me OK value.
    Thanks for any ideas.
    Marcin
    PS. Portal ver. 3.0.8

    You are right if you are using 3.0.8.9.8 (I didn't check in 307). It is no longer an issue in 3.0.9.8.0
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Bodziak:
    Steps to reproduce problem:
    1. create table in oracel using DBA, one column with [b]DATE type
    2. insert into table dates
    01-01-2001
    01-01-0001
    3. query this table using SQL*Plus
    4. Use portal to build QBE report on this table.
    5.Set calumn format dd-mm-yyyy
    6.See that Portal show the following result in query:
    01-01-2001
    01-01-2001
    <HR></BLOCKQUOTE>
    null

  • Minor bug in BindingContext

    To whom it may concern,
    I found the following minor bug in the BindingContext class: keysIterator() behaves like veluesIterator().
    I don't think this affects the framework right now, but here I post it.
    Product: JDeveloper 9.0.5.1 (Build 1605)
    Class: oracle.adf.model.BindingContext.java
    Code affected:
    * Returns a thread safe values iterator.
    public Iterator valuesIterator()
    HashMap copy = (HashMap)mContextMap.clone();
    return copy.values().iterator();
    * Returns a thread safe keys iterator.
    public Iterator keysIterator()
    HashMap copy = (HashMap)mContextMap.clone();
    return copy.values().iterator(); /* <-- This should be "copy.keySet().iterator();" instead. */
    Hope it helps,
    Lluís.

    Thanks for pointing this out. This will be fixed in the next release.
    JR

  • Minor bug in user interface

    I have noticed a minor bug in the user interface... the font color in develop module changes to barely legible whilst editing values using keyboard. Does not seem to affect the font when using sliders to change  values.

    We've got that one bugged, thanks au2045

  • [svn] 4513: Minor bug fixes.

    Revision: 4513
    Author: [email protected]
    Date: 2009-01-13 13:46:08 -0800 (Tue, 13 Jan 2009)
    Log Message:
    Minor bug fixes.
    * pausing effect currently sleeping through its startDelay now works
    * new effects now work correctly with nonzero repeatDelay
    * ASDoc fixes for ANIMATION_REPEAT event
    QE Notes: None
    Doc Notes: None
    Bugs: sdk-17993, sdk-17842, sdk-18672
    Reviewer: Jason
    Tests: checkintests, Mustella: Effects, gumbo/effects, ListDataEffects
    Ticket Links:
    http://bugs.adobe.com/jira/browse/sdk-17993
    http://bugs.adobe.com/jira/browse/sdk-17842
    http://bugs.adobe.com/jira/browse/sdk-18672
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/Animation.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/FxAnimate.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/effects/effectClasses/FxAnimateInstance.a s
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/events/AnimationEvent.as

    It means that small issues in the software were fixed.

  • Minor Bug in Azure Portal Preview

    Hello,
    When I create rule for database access, I receive "Firewall rule name must be unique" error if I write IP address before rule name.

    Hi Cha0s,
    Thanks for posting here.
    I tried to created the SQL db firewall rules using the management portal it worked fine by following these steps mentioned in the link.
    http://msdn.microsoft.com/en-us/library/jj553530.aspx
    Server-Level Firewall Rules
    Server-level firewall rules can be created and managed through the Microsoft Azure Management Portal, Transact-SQL, Azure PowerShell, or REST API.
    Manage Server-Level Firewall Rules through Management Portal
    From the Management Portal, click SQL Databases. All databases and their corresponding servers are listed here.
    Click Servers at the top of the page.
    Click the arrow beside the server for which you want to manage firewall rules.
    Click Configure at the top of the page.
    To add the current computer, click Add to the Allowed IP Addresses.
    To add additional IP addresses, type in the Rule Name,
    Start IP Address, and End IP Address.
    To modify an existing rule, click any of the fields in the rule and modify.
    To delete an existing rule, hover over the rule until the X appears at the end of the row.  Click
    X to remove the rule.
    Click Save at the bottom of the page to save the changes.
    Note: Unique does not mean new name to you while setting up the firewall rules, but it should be a new name provided where your database is located in the specified location(for eg. North Europe, East US datacenters.)
    Girish Prajwal

  • Minor bug with Connections node in SQL Dev. 2.1 EA1

    This is minor compared to some of the other issues found with EA1.
    When I expand the Connections node by clicking on the "+" I cannot collapse it when clicking on the "-". This happens both when migrating settings from 1.5.5 and when starting clean without migrating settings and then creating new connections. (I deleted the "system2.1.0.62.61" folder between tests.) I tried this by running "+<install_dir>+\sqldeveloper\sqldeveloper.exe" and "+<install_dir>+\sqldeveloper\sqldeveloper\bin\sqldeveloper.exe" to get a console window. (The only messages I saw in the console window occurred when I opened a connection.)
    Here are the "About" and "Version" info:
    About
    Oracle SQL Developer 2.1.0.62
    Version 2.1.0.62
    Build MAIN-62.61
    Copyright © 2005,2009 Oracle. All Rights Reserved.
    IDE Version: 11.1.1.2.36.54.96
    Product ID: oracle.sqldeveloper
    Product Version: 11.1.1.62.61
    Version
    Component     Version
    =========     =======
    Java(TM) Platform     1.6.0_14
    Oracle IDE     2.1.0.62.61
    Versioning Support     2.1.0.62.61
    FWIW, I can collapse and expand the Connections node in 1.5.5 without any problem.
    Ed. H.

    Thanks the bug is that the +/- is even being shown. I put something in there to prevent the collapsing of that since there's nothing when it's collapse.
    -kris

  • JDev 11r1 minor bug in Subversion Import Wizard

    Hi all,
    When performing the initial import of an application into a Subversion repository, on step 4 of 6 of the import wizard (Filters), there is a minor UI bug. Both the "New" button (for adding a new ignore filter) and the "Next" button (for going to the next step of the wizard) have a shortcut key of "N".
    Obviously not a show-stopper, but a minor annoyance.
    John

    Logged bug 7516297 for this

  • Bug in Portal308 HLW Tutorial

    When you try to install the latest portal tutorial the import of hlw30_trl_sso.dmp fails with a "column not found" because the portal30_sso.wwutl_sso_transport_table$ and wwutl_sso_tx_person$ tables are missing the SUBSCRIBER_ID column. I altered these tables and added the new column but this causes several packages to go invalid:
    portal30.wwsbr_imt_services
    portal30_sso.wwutl_api_ssotransport
    portal30_sso.wwutl_new
    only the portal30_sso.wwutl_new package can be compiled but the other two must be modified. The problem is though that these packages are wrapped and Oracle doesn't ship the source code.
    So if anyone knows how to get a hold of Darren McBurney or Vanessa Wang both of Oracle and notify them of the problem please do so - thanks
    John

    Darren,
    We're using the latest version of 9iAS/Portal 3.0.8. but apparently the subscriber_id column was added to the portal30_sso tables after this release and that is what ya'll are developing against. Is there a patch to fix the sso tables or do we have to wait for 3.0.9 for a fix.
    Thanks,
    John

  • Another Minor Bug in SQLDev

    I discovered another minor irritant in sqlDeveloper.
    Steps to recreate the bug:
    1) Create table t ( n1 number); (table created)
    2) insert into t values (1); Commit; (Record Committed)
    3) Goto Explorer on the left pane and click on the table to view the table t on the right (table will be displayed with a single column); Click on the data tab to view the data.
    4) Alter table t add (n2 binary_float); (Table modified)
    5) insert into t values (10, 10); Commit; (record committed)
    6) click on refresh button to view the data.
    You would expect to see two columns and two rows of record. But you would see only one column and two rows of data.
    7) click on columns tab and click on the refresh button. (Two columns are displayed).
    8) now go back to data tab; you would still see only ONE column and two records. Clicking on refresh does not display two columns
    Only alternative is to close the tab and click on the table t again. You can now view the records with two columns
    Version: 2.1.1.64
    OS: Linux
    Database: 11g
    -- rsrini

    I am having a similar problem in 2.1.063.10. When I put in a filter I need to use the enter key and not the refresh button. Nothing happens to the data grid when I hit refresh button. When I enter a filter that causes no data to display, then blank out the filter and hit the refresh button, no data is displayed in the grid. Then I hit enter and the data grid is refreshed.

  • Minor bug in dp-xml processing...

    Each time user selects a channel
    <Reference value="MyChannel" merge="replace" lock="false" propagate="true" advanced="false"/>"
    will be added to <Selected> in his dp.xml
    (even if <Reference value="MyChannel" merge="remove" lock="false" propagate="true" advanced="false"/>"
    already exists!)
    Now, each time user deselects a channel -
    only merge="remove" will be set for this element,
    but the entry will not be deleted!
    Which means in three months of intensive use
    your portal will get really slow...
    Cheers,
    Alex :-)

    Andy,
    1) Stangely enough, the Escape XML.vi doesn't escape "</"!
    2) Escape XML.vi takes a string, so you have to convert the picture to string. But when you convert the picture to string, the bug isn't there anymore.
    So to work around the problem, you can just convert the picture to string (use flatten to string, casting is (without any reason) disabled...).
    Someone who wants to flatten pictures to XML should be experienced enough to figure this out, so I wouldn't put the bug on the priority list. Also, fixing it could cause backwards compatibility problems.
    Regards,
    Wiebe.
    Attachments:
    Bug Flatten Picture To XML.vi ‏39 KB

  • Minor bug report SoundTrack Pro

    Hi,
    I would like to report what seems to be a little bug in SoundTrack Pro wav file creation process and haven't found a page where to send a ticket so I'm posting this here
    I am currently writing a programm to read simple WAVE fles with the basic scheme RIFF/WAVE/fmt /data and I am basically skipping any chunk whose ID differs from the four previous. Every chunk of meta in a WAVE file is supposed to be ChunkID on 4 bytes then, immediatly after, ChunkSize on 4 bytes too.
    SoundTrack Pro seems to respects this format for the APPL chunk (contains a path) except for one little bug: the size I read is one byte too short for me. And only for this chunk of meta. (Not the storage of the size, which is on 4 bytes too, the actual size of the whole chunk). I have to manually read one more byte when the chunk is APPL.
    Any ideas of where this should be reported ? Plus it is really minor, I don't really have a hope that this bug be corrected one day but anyway...
    Tignus.

    This is a user to user forum. To submit feedback to Apple, (with the program open) select Soundtrack Pro (the item just to the right of the Apple icon) then> Provide Soundtrack Pro Feedback. This will send an email to Apple.
    In the FWIW catagory, STP is a dead program. There will be no additional development on it.
    Good luck,
    x

  • Complete list of all bugs in portal 9.0.2

    Does anyone know if there is a complete list of all bugs and their respective patches (with release dates, preferably) for portal 9.0.2 (windows edition)?
    Regards,
    Lene

    it would be very useful to get a list of these one off patches as they are released - nothing is getting posted in this forum recently regarding availability of patches.
    Any bug fixes are a good thing, especially if it means I do not have to wait until Q1 next year for a patch set.

  • Help, experiencing minor bugs in program

    this is supposed to use rectangles and you should be able to load and save and they have colors and do a few more things with them, the loading is where it doesn't work.
    *-------------------------------------------------------------- 80 columns ---|
    * This is the main class for the application. It is built along the same
    * lines as the Editor class of project 1. It has a constructor, two instance
    * methods, and a static main()  that kicks the whole thing off.
    * The two instance methods are a menu creation method, and a menuItems
    * initialisation method.  The constructor instantiates the window
    * and sets up its internals by creating and installing the drawing canvas,
    * toolbar, and menus. All of the code works correctly as is and should
    * require no changes.
    * @version      1.1 15/04/01
    * @author       Julie Zelenski
    * @author       Restructured by Ian A. Mason
    * @see       javax.swing.JFrame
    * @see       javax.swing.JMenuBar
    * @see       javax.swing.JMenuItem
    * @see       javax.swing.JMenu
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class JavaDraw extends JFrame {
        final Toolbar toolbar = new Toolbar();
        final DrawingCanvas canvas = new DrawingCanvas(toolbar, 350, 350);
        final int menuMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
        final JMenuBar mb = new JMenuBar();
        final String[]
             fileMenuItems = {"Clear all", "Load file", "Save to file", "Quit"};
        final int[] fileKeyCodes = {KeyEvent.VK_N, KeyEvent.VK_O, KeyEvent.VK_S, KeyEvent.VK_Q};
        final ActionListener[] fileActionListeners = {
         new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  canvas.clearAll();}},
         new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  canvas.loadFile();}},
         new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  canvas.saveToFile();}},
         new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  System.exit(0);}}
        final String[] editMenuItems = {"Cut", "Copy", "Paste", "Delete"};
        final int[] editKeyCodes = {KeyEvent.VK_X, KeyEvent.VK_C, KeyEvent.VK_V, KeyEvent.VK_BACK_SPACE};
        final int[] editMenuMasks = {menuMask, menuMask, menuMask, 0};
        final ActionListener[] editActionListeners = {
         new ActionListener() {
              public void actionPerformed(ActionEvent e) { canvas.cut();}},
         new ActionListener() {
              public void actionPerformed(ActionEvent e) { canvas.copy();}},
         new ActionListener() {
              public void actionPerformed(ActionEvent e) { canvas.paste();}},
         new ActionListener() {
              public void actionPerformed(ActionEvent e) { canvas.delete();}}
        final String[] layeringMenuItems = {"Bring to front", "Send to back"};
        final int[]    layeringKeyCodes = {KeyEvent.VK_F, KeyEvent.VK_B};
        final ActionListener[] layeringActionListeners = {
         new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  canvas.bringToFront();}},
         new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  canvas.sendToBack();}}
        private JavaDraw(){
         super("JavaDraw!");
         toolbar.setCanvas(canvas);
         getContentPane().add(toolbar, BorderLayout.SOUTH);
         getContentPane().add(canvas, BorderLayout.CENTER);
         createMenus();
         setJMenuBar(mb);
         setLocation(100, 20);
         pack();
         setVisible(true);
        static public void main(String[] args){
         JavaDraw javaDraw = new JavaDraw();
        private void initMenus(JMenu m,
                      String  miLabel,
                      int keyCode,
                      int menuMask,
                      ActionListener al){
         JMenuItem mi = new JMenuItem(miLabel);
         m.add(mi);
         mi.addActionListener(al);
         mi.setAccelerator(KeyStroke.getKeyStroke(keyCode, menuMask));
        private void createMenus(){
         JMenu m;
         m = new JMenu("File");
         for(int i = 0; i < fileMenuItems.length; i++)
             initMenus(m,
                    fileMenuItems,
              fileKeyCodes[i],
              menuMask,
              fileActionListeners[i]);
         mb.add(m);
         m = new JMenu("Edit");
         for(int i = 0; i < editMenuItems.length; i++)
         initMenus(m,
              editMenuItems[i],
              editKeyCodes[i],
              editMenuMasks[i],
              editActionListeners[i]);
         mb.add(m);
         m = new JMenu("Layering");
         for(int i = 0; i < layeringMenuItems.length; i++)
         initMenus(m,
              layeringMenuItems[i],
              layeringKeyCodes[i],
              menuMask,
              layeringActionListeners[i]);
         mb.add(m);
    *-------------------------------------------------------------- 80 columns ---|
    * The DrawingCanvas class a small extension of JComponent
    * @version 1.1 15/04/01
    * @author Julie Zelenski
    * @author (touched up by Ian A. Mason)
    * @see javax.swing.JComponent
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    public class DrawingCanvas extends JComponent{
    static final int DRAG_NONE = 0;
    static final int DRAG_CREATE = 1;
    static final int DRAG_RESIZE = 2;
    static final int DRAG_MOVE = 3;
    // list of all shapes on canvas
    protected Vector allShapes;          
    // currently selected shape (can be null at times)
    protected Rect selectedShape;
    // reference to toolbar to message for tool&color settings
    protected Toolbar toolbar;
    protected Rect clipboard=null;          
    /* These are the unimplemented menu commands. The menus are already
    * set up to send the correct messages to the canvas, but the
    * method bodies themselves are currently completely empty. It will
    * be your job to fill them in!
    public void cut() {
         copy();
         delete();
    public void copy() {
         int x=(int)selectedShape.getBounds().getX();
         int y=(int)selectedShape.getBounds().getY();
         Point p=new Point(x,y);
         clipboard=new Rect(p,this);
         clipboard.setBounds(selectedShape.getBounds());
    public void paste() {
         if(clipboard==null)
              return;
         allShapes.add(clipboard);
         setSelectedShape(clipboard);
         copy();
         this.repaint();
    public void delete() {
         if(selectedShape==null)
              return;
         else{
         int num=allShapes.indexOf(selectedShape);
         allShapes.remove(num);
         selectedShape=null;
         this.repaint();
    public void clearAll() {
         allShapes.removeAllElements();
         this.repaint();
    public void loadFile() {
         Load load=new Load(this);
         load.setSize(250,200);
         load.validate();
         load.setVisible(true);
    public void done(Vector vect){
         allShapes.removeAllElements();
         for(int i=0;i<vect.size();i++){
              allShapes.add(vect.elementAt(i));
         this.repaint();
    public void saveToFile() {
         Save save=new Save(allShapes);
         save.setSize(250,200);
         save.validate();
         save.setVisible(true);
    public void bringToFront() {
         if(selectedShape==null)
              return;
         int size=allShapes.size();
         int index=allShapes.indexOf(selectedShape);
         for(int i=index+1;i<=size-1;i++){
              allShapes.set(i-1,allShapes.elementAt(i));
         allShapes.set(size-1,selectedShape);
         this.repaint();
    public void sendToBack() {
         if(selectedShape==null)
              return;
         int index=allShapes.indexOf(selectedShape);
         for(int i=index-1;i>=0;i--){
              allShapes.remove(allShapes.elementAt(i+1));
              allShapes.add(i+1,allShapes.elementAt(i));
         allShapes.remove(allShapes.elementAt(0));
         allShapes.add(0,selectedShape);
         this.repaint();
    * Constructor for creating a new empty DrawingCanvas. We set up
    * our size and background colors, instantiate an empty vector of shapes,
    * and install a listener for mouse events using our inner class
    * CanvasMouseHandler
    public DrawingCanvas(Toolbar tb, int width, int height){
         setPreferredSize(new Dimension(width, height));
         setBackground(Color.white);
         toolbar = tb;
         allShapes = new Vector();
         selectedShape = null;
         CanvasMouseHandler handler = new CanvasMouseHandler();
         addMouseListener(handler);
         addMouseMotionListener(handler);
    * All components are responsible for drawing themselves in
    * response to repaint() requests. The standard method a component
    * overrides is paint(Graphics g), but for Swing components, the default
    * paint() handler calls paintBorder(), paintComponent() and paintChildren()
    * For a Swing component, you override paintComponent and do your
    * drawing in that method. For the drawing canvas, we want to
    * clear the background, then iterate through our shapes asking each
    * to draw. The Graphics object is clipped to the region to update
    * and we use to that avoid needlessly redrawing shapes outside the
    * update region.
    public void paintComponent(Graphics g){
         Rectangle regionToRedraw = g.getClipBounds();
         g.setColor(getBackground());
         g.fillRect(regionToRedraw.x, regionToRedraw.y,
              regionToRedraw.width, regionToRedraw.height);
         Iterator iter = allShapes.iterator();
         while (iter.hasNext())
         ((Rect)iter.next()).draw(g, regionToRedraw);
    * Changes the currently selected shape. There is at most
    * one shape selected at a time on the canvas. It is possible
    * for the selected shape to be null. Messages the shape to
    * change its selected state which will in turn refresh the
    * shape with the knobs active.
    protected void setSelectedShape(Rect shapeToSelect) {
         // if change in selection
         if (selectedShape != shapeToSelect) {
         // deselect previous selection
         if (selectedShape != null)
              selectedShape.setSelected(false);
         // set selection to new shape
         selectedShape = shapeToSelect;
         if (selectedShape != null) {
              shapeToSelect.setSelected(true);
    * A hit-test routine which finds the topmost shape underneath a
    * given point.We search Vector of shapes in back-to-front order
    * since shapes created later are added to end and drawn last, thus
    * appearing to be "on top" of the earlier ones. When a click comes
    * in, we want to select the top-most shape.
    protected Rect shapeContainingPoint(Point pt){
         for (int i = allShapes.size()-1; i >= 0; i--) {
         Rect r = (Rect)allShapes.elementAt(i);
         if (r.inside(pt)) return r;
         return null;
    * The inner class CanvasMouseHandler is the object that handles the
    * mouse actions (press, drag, release) over the canvas. Since there is
    * a bit of state to drag during the various operations (which shape,
    * where we started from, etc.) it is convenient to encapsulate all that
    * state with this little convenience object and register it as the
    * handler for mouse events on the canvas.
    protected class CanvasMouseHandler
         extends MouseAdapter implements MouseMotionListener {
         Point dragAnchor;          
         // variables using to track state during drag operations
         int dragStatus;
         /** When the mouse is pressed we need to figure out what
         * action to take. If the tool mode is arrow, the click might
         * be a select, move or reisze. If the tool mode is one of the
         * shapes, the click initiates creation of a new shape.
         public void mousePressed(MouseEvent event){
         Rect clicked = null;
         Point curPt = event.getPoint();
         // first, determine if click was on resize knob of selected shape
         if (toolbar.getCurrentTool() == Toolbar.SELECT) {
              if (selectedShape != null &&
              (dragAnchor = selectedShape.getAnchorForResize(curPt))
              != null) {
              // drag will resize this shape
              dragStatus = DRAG_RESIZE;     
              } else if ((clicked = shapeContainingPoint(curPt)) != null) {
              // if not, check if any shape was clicked
              setSelectedShape(clicked);
              // drag will move this shape      
              dragStatus = DRAG_MOVE;
              dragAnchor = curPt;
              } else {     
              // else this was a click in empty area,
              // deselect selected shape,
              setSelectedShape(null);
              // drag does nothing in this case
              dragStatus = DRAG_NONE;
         } else {
              Rect newShape = new Rect(curPt, DrawingCanvas.this);
              // create rect here
              allShapes.add(newShape);
              setSelectedShape(newShape);
              dragStatus = DRAG_CREATE;          
              // drag will create (resize) this shape
              dragAnchor = curPt;
         /** As the mouse is dragged, our listener will receive periodic
         * updates as mouseDragged events. When we get an update position,
         * we update the move/resize event that is in progress.
         public void mouseDragged(MouseEvent event){
         Point curPt = event.getPoint();
         switch (dragStatus) {
         case DRAG_MOVE:
              selectedShape.translate(curPt.x - dragAnchor.x,
                             curPt.y - dragAnchor.y);
              // update for next dragged event
              dragAnchor = curPt;
              break;
         case DRAG_CREATE: case DRAG_RESIZE:
              selectedShape.resize(dragAnchor, curPt);
              break;
         public void mouseMoved(MouseEvent e) {}
    /** A little helper routine that will be useful for the load & save
    * operations. It brings up the standard JFileChooser dialog and
    * allows the user to specify a file to open or save. The return
    * value is the full path to the chosen file or null if no file was
    * selected.
    protected String filenameChosenByUser(boolean forOpen){
         JFileChooser fc = new JFileChooser(System.getProperty("user.dir") +
                             java.io.File.separator + "Documents");
         int result = (forOpen? (fc.showOpenDialog(this)) :
              fc.showSaveDialog(this));
         java.io.File chosenFile = fc.getSelectedFile();
         if (result == JFileChooser.APPROVE_OPTION && chosenFile != null)
         return chosenFile.getPath();
         return null;
         // return null if no file chosen or dialog cancelled
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    import java.io.*;
    class Load extends JFrame implements ActionListener, Serializable{
         Container contentPane;
         JTextField jtf;
         JButton jb;
         Object obj=null;
         Load load;
         Thread thread;
         DrawingCanvas draw;
         public Load(DrawingCanvas dc){
              draw=dc;
              contentPane=getContentPane();
              contentPane.setLayout(new FlowLayout());
              jtf=new JTextField(20);
              jb=new JButton("Load");
              jb.addActionListener(this);
              contentPane.add(jtf);
              contentPane.add(jb);
         public void actionPerformed(ActionEvent e){
              String text=jtf.getText();
              SimpleObjectReader reader=SimpleObjectReader.openFileForReading(text+".shp");
              if(reader==null){
                   System.out.println("Couldn't open file!");
                   return;
              obj=reader.readObject();
              reader.close();
              draw.done((Vector)obj);
              this.setVisible(false);
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Vector;
    import java.io.*;
    class Save extends JFrame implements ActionListener, Serializable{
         Container contentPane;
         JTextField jtf;
         Vector shapes;
         JButton jb;
         public Save(Vector shapeVector){
              shapes=shapeVector;
              contentPane=getContentPane();
              contentPane.setLayout(new FlowLayout());
              jtf=new JTextField(20);
              jb=new JButton("Save");
              jb.addActionListener(this);
              contentPane.add(jtf);
              contentPane.add(jb);
         public void actionPerformed(ActionEvent e){
              String text=jtf.getText();
              SimpleObjectWriter writer=SimpleObjectWriter.openFileForWriting(text+".shp");
              if(writer==null){
                   System.out.println("Couldn't open file!");
                   return;
              writer.writeObject(shapes);
              writer.close();
              this.setVisible(false);
    *-------------------------------------------------------------- 80 columns ---|
    * The RectShape class defines a simple rectangular shape object.
    * It tracks its bounding box, selected state, and the canvas it is being
    * drawn in. It has some basic methods to select, move, and resize the
    * rectangle. It has methods that draw the shape in the selected or unselected
    * states and updates the canvas whenever the state or bounds of the rectangle
    * change. The code that is there works properly, but you will need to extend
    * and change the code to support additional features.
    * @version 1.1 15/04/01
    * @author Julie Zelenski
    * @author (touched up by Ian A. Mason)
    import java.awt.*;
    import java.io.*;
    public class Rect implements Serializable{     
    protected Rectangle bounds;
    protected boolean isSelected;
    public Color color;
    public DrawingCanvas canvas;
    protected static final int KNOB_SIZE = 6;
    protected static final int NONE = -1;
    protected static final int NW = 0;
    protected static final int SW = 1;
    protected static final int SE = 2;
    protected static final int NE = 3;
    /** The constructor that creates a new zero width and height rectangle
    * at the given position in the canvas.
    public Rect(Point start, DrawingCanvas dcanvas){
         canvas = dcanvas;
         bounds = new Rectangle(start);
         color=canvas.toolbar.getCurrentColor();
    /** The "primitive" for all resizing/moving/creating operations that
    * affect the rect bounding box. The current implementation just resets
    * the bounds variable and triggers a re-draw of the union of the old &
    * new rectangles. This will redraw the shape in new size and place and
    * also "erase" if bounds are now smaller than before. It is a good
    * design to have all changes to a critical variable bottleneck through
    * one method so that you can be sure that all the updating that goes
    * with it only needs to be implemented in this one place. If any of your
    * subclasses have additional work to do when the bounds change, this is
    * the method to override. Make sure that any methods that change the
    * bounds call this method instead of directly manipulating the variable.
    protected void setBounds(Rectangle newBounds){
         Rectangle oldBounds = bounds;
         bounds = newBounds;
         updateCanvas(oldBounds.union(bounds));
    /** The resize operation is called when first creating a rect, as well as
    * when later resizing by dragging one of its knobs. The two parameters
    * are the points that define the new bounding box. The anchor point
    * is the location of the mouse-down event during a creation operation
    * or the opposite corner of the knob being dragged during a resize
    * operation. The end is the current location of the mouse. If you
    * create the smallest rectangle which encloses these two points, you
    * will have the new bounding box. Use the setBounds() primitive which
    * is the bottleneck we are using for all geometry changes, it handles
    * updating and redrawing.
    public void resize(Point anchor, Point end){
         Rectangle newRect = new Rectangle(anchor);
         // creates smallest rectange which
         // includes both anchor & end
         newRect.add(end);
         // reset bounds & redraw affected areas
         setBounds(newRect);      
    public Rectangle getBounds(){
         return bounds;
    /** The translate operation is called when moving a shape by dragging in
    * the canvas. The two parameters are the delta-x and delta-y to move
    * by. Note that either or both can be negative. Create a new rectangle
    * from our bounds and translate and then go through the setBounds()
    * primitive to change it.
    public void translate(int dx, int dy){
         Rectangle newRect = new Rectangle(bounds);
         newRect.translate(dx, dy);
         setBounds(newRect);
    /** Used to change the selected state of the shape which will require
    * updating the affected area of the canvas to add/remove knobs.
    public void setSelected(boolean newState){
         isSelected = newState;
         // need to erase/add knobs
         // including extent of extended bounds
         updateCanvas(bounds, true);
    /** The updateCanvas() methods are used when the state has changed
    * in such a way that it needs to be refreshed in the canvas to properly
    * reflect the new settings. The shape should take responsibility for
    * messaging the canvas to properly update itself. The appropriate AWT/JFC
    * way to re-draw a component is to send it the repaint() method with the
    * rectangle that needs refreshing. This will cause an update() event to
    * be sent to the component which in turn will call paint(), where the
    * real drawing implementation goes. See the paint() method in
    * DrawingCanvas to see how it is implemented.
    protected void updateCanvas(Rectangle areaOfChange, boolean enlargeForKnobs){
         Rectangle toRedraw = new Rectangle(areaOfChange);
         if (enlargeForKnobs)
         toRedraw.grow(KNOB_SIZE/2, KNOB_SIZE/2);
         canvas.repaint(toRedraw);
    protected void updateCanvas(Rectangle areaOfChange){
         updateCanvas(areaOfChange, isSelected);
    /** When the DrawingCanvas needs a shape to draw itself, it sends a draw
    * message, passing the graphics context and the current region being
    * redrawn. If the shape intersects with that region, it must draw itself
    * doing whatever it takes to properly represent itself in the canvas
    * (colors, location, size, knobs, etc.) by messaging the Graphics object.
    public void draw(Graphics g, Rectangle regionToDraw){
         if (!bounds.intersects(regionToDraw))
         return;
         g.setColor(color);
         g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
         if (isSelected) { // if selected, draw the resizing knobs
         // along the 4 corners
         Rectangle[] knobs = getKnobRects();
         for (int i = 0; i < knobs.length; i++)
              g.fillRect(knobs[i].x, knobs[i].y,
                   knobs[i].width, knobs[i].height);
    /** When the DrawingCanvas needs to determine which shape is under
    * the mouse, it asks the shape to determine if a point is "inside".
    * This method should returns true if the given point is inside the
    * region for this shape. For a rectangle, any point within the
    * bounding box is inside the shape.
    public boolean inside(Point pt){
         return bounds.contains(pt);
    /** When needed, we create the array of knob rectangles on demand. This
    * does mean we create and discard the array and rectangles repeatedly.
    * These are small objects, so perhaps it is not a big deal, but
    * a valid alternative would be to store the array of knobs as an
    * instance variable of the Shape and and update the knobs as the bounds
    * change. This means a little more memory overhead for each Shape
    * (since it is always storing the knobs, even when not being used) and
    * having that redundant data opens up the possibility of bugs from
    * getting out of synch (bounds move but knobs didn't, etc.) but you may
    * find that a more appealing way to go. Either way is fine with us.
    * Note this method provides a nice unified place for one override from
    * a shape subclass to substitute fewer or different knobs.
    protected Rectangle[] getKnobRects(){
         Rectangle[] knobs = new Rectangle[4];
         knobs[NW] = new Rectangle(bounds.x - KNOB_SIZE/2,
                        bounds.y - KNOB_SIZE/2, KNOB_SIZE, KNOB_SIZE);
         knobs[SW] = new Rectangle(bounds.x - KNOB_SIZE/2,
                        bounds.y + bounds.height - KNOB_SIZE/2,
                        KNOB_SIZE, KNOB_SIZE);
         knobs[SE] = new Rectangle(bounds.x + bounds.width - KNOB_SIZE/2,
                        bounds.y + bounds.height - KNOB_SIZE/2,
                        KNOB_SIZE, KNOB_SIZE);
         knobs[NE] = new Rectangle(bounds.x + bounds.width - KNOB_SIZE/2,
                        bounds.y - KNOB_SIZE/2,
                        KNOB_SIZE, KNOB_SIZE);
         return knobs;
    /** Helper method to determine if a point is within one of the resize
    * corner knobs. If not selected, we have no resize knobs, so it can't
    * have been a click on one. Otherwise, we calculate the knob rects and
    * then check whether the point falls in one of them. The return value
    * is one of NW, NE, SW, SE constants depending on which knob is found,
    * or NONE if the click doesn't fall within any knob.
    protected int getKnobContainingPoint(Point pt){
         // if we aren't selected, the knobs
         // aren't showing and thus there are no knobs to check
         if (!isSelected) return NONE;
         Rectangle[] knobs = getKnobRects();
         for (int i = 0; i < knobs.length; i++)
         if (knobs[i].contains(pt))
              return i;
         return NONE;
    /** Method used by DrawingCanvas to determine if a mouse click is starting
    * a resize event. In order for it to be a resize, the click must have
    * been within one of the knob rects (checked by the helper method
    * getKnobContainingPoint) and if so, we return the "anchor" ie the knob
    * opposite this corner that will remain fixed as the user drags the
    * resizing knob of the other corner around. During the drag actions of a
    * resize, that fixed anchor point and the current mouse point will be
    * passed to the resize method, which will reset the bounds in response
    * to the movement. If the mouseLocation wasn't a click in a knob and
    * thus not the beginning of a resize event, null is returned.
    public Point getAnchorForResize(Point mouseLocation){
         int whichKnob = getKnobContainingPoint(mouseLocation);
         // no resize knob is at this location
         if (whichKnob == NONE)
         return null;
         switch (whichKnob) {
         case NW: return new Point(bounds.x + bounds.width,
                        bounds.y + bounds.height);
         case NE: return new Point(bounds.x, bounds.y + bounds.height);
         case SW: return new Point(bounds.x + bounds.width, bounds.y);
         case SE: return new Point(bounds.x, bounds.y);
         return null;
    import java.io.*;
    * SimpleObjectReader is a small class to wrap around the usual ObjectStream
    * to shield you from the exception handling which we haven't yet gotten
    * to in class.
    * <P>It has just three methods of note: one to open a new file for reading,
    * one to read an object from an open file, and one to close the file when done.
    * <P>Any object that you attempt to read must properly implement the Serializable
    * interface. Here is a simple example that shows using the SimpleFileReader to
    * to rehydrate objects from a file and print them:
    * <PRE>
    * SimpleObjectReader reader = SimpleObjectReader.openFileForReading("shapes");
    * if (reader == null) {
    * System.out.println("Couldn't open file!");
    * return;
    * Object obj;
    * while ((obj = reader.readObject()) != null)
    * System.out.println(obj);
    * reader.close();
    * </PRE>
    * <P>You are free to edit or extend this class, but we don't expect that
    * you should need to make any changes.
    * @version 1.1 15/04/01
    * @author Julie Zelenski
    * @author (touched up by Ian A. Mason)
    public class SimpleObjectReader {
    private ObjectInputStream ois;
    * Opens a new file for reading. The filename can either be a relative
    * path, which will be relative to the working directory of the program
    * when started, or an absolute path. If the file exists and can be
    * opened, a new SimpleObjectReader is returned. If the file cannot be
    * opened (for any reason: wrong name, wrong path, lack of permissions, etc.)
    * null is returned.
    public static SimpleObjectReader openFileForReading(String filename){
         try {
         return new SimpleObjectReader(new ObjectInputStream(new FileInputStream(filename)));
         } catch(IOException e) {     
         return null;
    * Reads a single object from the file and returns it. If there are
    * no more objects in the file (i.e, we have reached the end of file),
    * null is returned null is returned. null is also
    * returned on any I/O error.
    public Object readObject (){
         try {
         return ois.readObject();
         } catch (IOException e) {
         e.printStackTrace();
         return null;
         } catch (ClassNotFoundException e) {
         e.printStackTrace();
         return null;
    * Closes the file when done reading. You should close a reader when
    * you are finished to release the OS resources for use by others.
    public void close (){
         try {
         ois.close();
         catch (IOException e) {}
    * Constructor is private so that only means to create a new reader
    * is through the static method which does error checking.
    private SimpleObjectReader(ObjectInputStream ois){
         this.ois = ois;
    import java.io.*;
    * SimpleObjectWriter is a small class to wrap around the usual
    * ObjectOutputStream to shield you from the exception handling
    * which we haven't yet gotten to in class.
    * <P>It has just three methods of note: one to open a new file for writing,
    * one to write an object to the file, and one to close the
    * the file when done.
    * <P>Here is a simple example that shows using the SimpleObjectWriter
    * to create a new file and write some objects into it:
    * <PRE>
    * SimpleObjectWriter writer =
    * SimpleObjectWriter.openFileForWriting("objects");
    * if (writer == null) {
    * System.out.println("Couldn't open file!");
    * return;
    * writer.writeObject("Here is a string");
    * writer.writeObject("And another one.");
    * writer.writeObject(new Date());
    * writer.close();
    * </PRE>
    * <P>You are free to edit or extend this class, but we don't expect that
    * you should need to make any changes.
    * @version 1.1 15/04/01
    * @author Julie Zelenski
    * @author (touched up by Ian A. Mason)
    public class SimpleObjectWriter {
    private ObjectOutputStream oos;
    * Opens a new file for writing. The filename can either be a relative
    * path, which will be relative to the working directory of the program
    * when started, or an absolute path. If the file can be created, a
    * new SimpleObjectWriter is returned. If the file already exists, this
    * will overwrite its content

    I'm not reading that either, but to help you for next time:
    - use more than 1 sentence to describe your problem
    - only post the RELEVANT code, or a small test program with the same problem if possible.
    At least you formatted it, I'll give you that.
    Cheers,
    Radish21
    PS. I think in this case, posting another (better worded) thread might be a good idea, because no one is going to read this one. In general though, don't :)

Maybe you are looking for