JSplitPane/JMenu/AffineTransform & unexpected shifting drawing on resize

I was able to reproduce my problem with the code snippet below. Whenever I move the divider or resize the window, the line
will jump, if I don't do a translation transform and use absolute positioning - I don't see any jumping. If I use translation and remove the menubar - it works. If I use translation and I remove the split pane - it works. Is this a bug? Or should I do painting differently.
OS: FreeBSD 6.2 x86 using eclipse w/ JDK1.6
Tried this code under JDK1.6 BSD Native and Linux Compatibitlity Mode JDK1.6 - both produce the same problem.
Any advice appreciated,
Monty
package temp;
import java.awt.geom.AffineTransform;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.SwingUtilities;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JSplitPane;
import java.awt.GridBagLayout;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
public class EntryPoint {
     private JFrame jFrame = null;
     private JPanel jContentPane = null;
     private JSplitPane jSplitPane = null;
     private JPanel jPanel = null;
     private JPanel jPanel1 = null;
     private JMenuBar jJMenuBar = null;
     private JMenu jMenu = null;
     private JFrame getJFrame() {
          if (jFrame == null) {
               jFrame = new JFrame();
               jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               jFrame.setSize(300, 200);
               jFrame.setContentPane(getJContentPane());
               jFrame.setJMenuBar(getJJMenuBar());
               jFrame.setTitle("Application");
          return jFrame;
     private JPanel getJContentPane() {
          if (jContentPane == null) {
               jContentPane = new JPanel();
               jContentPane.setLayout(new BorderLayout());
               jContentPane.add(getJSplitPane(), BorderLayout.CENTER);
          return jContentPane;
     private JSplitPane getJSplitPane() {
          if (jSplitPane == null) {
               jSplitPane = new JSplitPane();
               jSplitPane.setDividerLocation(100);
               jSplitPane.setLeftComponent(getJPanel());
               jSplitPane.setRightComponent(getJPanel1());
          return jSplitPane;
     private JPanel getJPanel() {
          if (jPanel == null) {
               jPanel = new JPanel();
               jPanel.setLayout(new GridBagLayout());
          return jPanel;
     private JPanel getJPanel1() {
          if (jPanel1 == null) {
               jPanel1 = new JPanel() {
                    public void paintComponent(Graphics g) {
                         super.paintComponent(g);
                         Graphics2D g2 = (Graphics2D) g;
                         AffineTransform at = new AffineTransform();
                         at.translate(100,100);
                         g2.setTransform(at);
                         g2.drawLine(0,0,100,100);
          return jPanel1;
     private JMenuBar getJJMenuBar() {
          if (jJMenuBar == null) {
               jJMenuBar = new JMenuBar();
               jJMenuBar.add(getJMenu());
          return jJMenuBar;
     private JMenu getJMenu() {
          if (jMenu == null) {
               jMenu = new JMenu("JUNK");
          return jMenu;
     public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
               public void run() {
                    EntryPoint application = new EntryPoint();
                    application.getJFrame().setVisible(true);
}

Using JDK1.4.2 on XP I get different results. I'm not sure what you are trying to do. The standard code for painting should be:
super.paintComponent(g);
g.drawLine(0,0,100,100);The line will start at the top left of the panel and continue until 100, 100. As the divider is moved the line will move since the panel is now being painted at a new position within the splitpane. So it is normal for the line to move when the divider is moved.
If you want to paint the line at some point relative to the top left of the panel then you can use:
super.paintComponent(g);
g.translate(100, 100);
g.drawLine(0,0,100,100);
g.translate(-100, -100);

Similar Messages

  • Buttons w/in mc unexpectedly shifting: .fla to .swf

    Hi
    In Flash CS3 I am making a menu bar with buttons but am
    having issues with the position of the buttons changing
    unexpectedly when testing or publishing the file.
    My menu bar consists of a long, horizontal box on top of
    which I have text-based buttons "Home", "Portfolio", etc.. I have
    the buttons so there is an even space above and below them but when
    I test or export the file all the buttons shift
    Has anyone heard about this type of issue or know of any
    solutions for this problem.
    Thank you

    Hi!
    Did you made a (a.c) stop, at every scene on the first frame? Or where ever you want to navigate to?
    Goodluck! Ishi Greetings!

  • Shift key not resizing proportionately

    I'm on CS4 Illustrator and it seems when I resize while holding down the shift key, the object isn't staying proportioned. Also, when I resize an object by clicking on the width and height value in the menu bar, the object does not stay centered when it resizes.
    Is a setting off?

    qindi,
    Presuming you have ticked the Center Reeference Point in the Transform palette, both issues may be caused by corrupted preferences.
    You may try to Ctrl/Cmd+Alt/Option+Shift during startup or to Move the folder to set things right.

  • Unexpected Shift+parent Behavior - AE CC

    Todd mentioned that shift+parent has some new functionality in the "What's New" post.
    (http://blogs.adobe.com/aftereffects/2013/04/whats-new-changed-after-effects-next.html - See "changes to Shift+parenting behavior:")
    However, I've noticed another change that is less than desirable.  When shift+parenting, the child layer jumps to the comp center coordinates (eg. [960, 540]) instead of the anchor point coordinates of the parent as it would in CS6.
    Is this intended and/or should I report a bug?

    I think you are misinterpreting what it says in the explanation. Let's say your child layer is at 200, 200 and the parent layer is at 400, 400. If you hold down the shift key and select the parent layer the child layer will move to 400, 400 in the comp window. This happens whether or not the child layer was previously connected to the same or a different parent layer.
    After holding down the shift key and selecting a parent the position of both layers should be the same. The position values may not be the same, but the actual position should be. In other words if you child layer and your parent layer were both 200 pixels square they should overlap perfectly when using the shift + select parent feature as long as the anchor points for both layers are the same are the same.

  • JSplitPane acts weird when resized very small

    Say I have two JPanels in a horizontal JSplitpane. One is in the left pane, the other the right. Each JPanel sits in another JPanel that uses a Borderlayout, holding a JPanel in the center.
    I place the JSplitPane in a JFrame. When I resize the JFrame to the size of a postage stamp, the right JPanel disappears. OK, I can live with that. But when I resize to say 600x800, the left JPanel takes all the room, the divider sits to the far right and the right JPanel is completely hidden. Argh! How can I avoid this? I know there must be a way but how? When I resize the JFrame to a small size, possibly 1cm x 1cm, one of the panels gets lost and upon resizing the divider will be either to the far right or left with one JPanel taking all the room and the other hidden.
    Help! My boss is threatening to fire me if I can't fix this. Ok, the last part was a joke but still a solution would be great.

    I would suspect that it has something to do with the minimum sizes of the components in the splitpane. This seems to work OK.import java.awt.*;
    import javax.swing.*;
    public class Test extends JFrame {
      public Test() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                        new JLabel("Left"), new JLabel("Right"));
        content.add(jsp, BorderLayout.CENTER);
        setSize(300, 300);
        setVisible(true);
      public static void main(String[] args) { new Test(); }
    }

  • Draw with pixel aspect ratio

    I use pencil tool, brush size 1 pixel. When pixel aspect ratio less then 1, pen draws a double pixels. Does
    anyone have solutions to it?

    Looking into this a little more, what I think is going on is that in previous versions, Shift dragging compensated for the non-square pixels, so that drawn items show up correctly.  If you look at the Info Box in 5.5 when shift drawing a circle, the height is greater then the width, when working in a non-square document.
    In 6.0, when you do the same thing, the height and width are the same. So, no compensation is being done for the non-square pixels.
    In 5.5, if you place a circle by entering the dimensions in the ellipse option, say 400, by 400, with PAR turned on, the image is squeezed side to side.
    So, In 5.5 Shift Compansated for nonSquare pixels. In CS6, it does not.

  • Trouble resizing layers to specific dimensions

    Hello. I am using PSE 5 and I am trying to make an 11 x 8.5 brochure for my business, which will have a mixture of text and pictures. What I want to do is place four pictures in the brochure but the pictures, when dragged in, cover the whole brochure. I want to be able to resize each picture (layer) to 3 wide while constraining the height to 2.25.
    Currently I can resize each layer by dragging one of the rectangular markers located around the active layer, but the scale is not preserved. I have looked in my PSE 5 help file, Adobes online help and Google to no avail. One site said hold the Shift key when resizing a layer to constrain its proportions, but this did not work for me.
    When modifying a picture in a Microsoft Word document, the size can easily be modified by right clicking on the image and selecting «Format Picture» followed by clicking on the «Size» tab. Is there a similar feature is PSE 5?
    Thank you

    Dennis,
    This program does not work the way MS Word does, and it may be easier to make a brochure with Word or a print shop program. However, one can make an artful collage in Elements.
    1. It is desirable to have the resolution of the canvas and of the individual pictures the same. One can check the resolution in Image>resize>image size for each picture file, then resize as necessary
    2. File>new>blank file will allow one to open a blank file in accordance with the dimensions (11x8.5")which you require. The resolution can be specified in this dialog as well. For printing, it is desirable to have a resolution of 240-300px/in. Create such a blank file.
    3. This blank file will be the background layer, as seen in the layers palette
    4. Open a picture file. Go to Select>all, then Edit>copy. Make the background layer active (the one from step #2), go to Edit>paste. This will place the picture on its own layer
    5. Access the move tool, and resize the picture utilizing one of the corner handles.
    6. Repeat for each picture.
    7. Text will be on its own layer as well
    8. 3x2.25" dimensions are unique, and I would crop each picture to this specification before step #4 above. With care, you may have minimal distortion.
    HTH,
    Ken

  • Preview app auto-resize window

    Shift-command-R resizes the image to fit window. How do you resize window to fit an image at it's original size? What a glaring oversight by Apple.

    I don't need the image to be full screen, just the window. And the window is not technically full screen, because you can still see the window borders and the panels. I want the image window with the different image tabs to open as big as my screen. I want the edges to come right up next to my panels and the bottom to go down to the bottom of my screen. For example: I use Mac and when you close a finder window and open a new one, it will open at the same size that you closed it. If you resize it, lets say, to fill your entire screen, close it and then reopen it, it will open the same size as you closed it. I don't want photoshop to open new image windows to the same dimension as the image. I want a grey screen to cover my entire monitor just like in CS3 and before. I really like the tabs, but I want the window to open bigger with grey space arround the image.

  • Pencil Tool not working after resize on CS5

    Hi, just has the title says, every time i draw and resize, the Pencil Tool stop working, i need to close the file and open it again to have it work. Please any help will be valuable.
    Thank you
    Bruno

    Could you please post a screenshot with the Layers Panel visible?

  • CS 6 Shift-Circle with Aspect Ratio Correction

    In PhotoShop CS 4 & 5.5, with a NTSC D1, 720x 486 document, a Pixel Aspect Ratio of D1.DV NTSC (0.91), and ellipse options set to unconstrained, with Aspect Ratio Correction Turned on, to draw a perfect Circle, you could hold Shift-option-cmd and you'd get a perfect Circle.
    In PhotoShop CS 6, the circle is streched to the top and bottom when I do a shift-Drag to draw a circle in a non-square Pixel document with Aspect Ratio Correction turned off.
    So, at this point, In a Non-Square Pixel document, There's no way to draw a perfect circle.
    What's changed between 5.5 and 6?? Is there a Preference somewhere that I've missed???
    TIA
    jamie

    Looking into this a little more, what I think is going on is that in previous versions, Shift dragging compensated for the non-square pixels, so that drawn items show up correctly.  If you look at the Info Box in 5.5 when shift drawing a circle, the height is greater then the width, when working in a non-square document.
    In 6.0, when you do the same thing, the height and width are the same. So, no compensation is being done for the non-square pixels.
    In 5.5, if you place a circle by entering the dimensions in the ellipse option, say 400, by 400, with PAR turned on, the image is squeezed side to side.
    So, In 5.5 Shift Compansated for nonSquare pixels. In CS6, it does not.

  • Logic Pro X v10.0.7 is out

    http://support.apple.com/kb/TS4498
    this is a looooong list

    ...and the full list of changes and fixes .......
    Logic Pro X 10.0.7 update
    New Features and Enhancements
    It is now possible to insert the current values of volume, pan, and all active sends of selected tracks as automation points at the playhead position. The new functions are accessible as a menu option or key command.
    It is now possible to paste track automation data at the Playhead or Marquee selection location.
    A new MIDI Project Setting allows MIDI CC 7 (volume) and MIDI CC 10 (pan) messages to control the instrument plug-in instead of the channel strip.
    The output of Auxiliary channel strips assigned to Tracks will now generate audio files when using any of the following Export menu options: "Region as Audio File," "Track as Audio File," or "All Tracks as Audio Files."
    Logic now supports up to 24 processing threads on computers with 12 cores.
    All menu items related to Snap, Alignment Guides, and "Snap to Grid" settings have been consolidated into the Snap menu in the Main window.
    It is now possible to activate/deactivate multiple plug-ins on a channel strip by vertically click-dragging the mouse over their power buttons.
    An auto-saved version of a project now contains the Undo History of the project from which it was derived.
    It is now possible to install the Logic content to an alternate system drive even if the Logic application is not installed there.
    Activating Auto Punch with a key command or Marquee selection now automatically adds the Autopunch button to the Control Bar.
    It is now possible to use modifiers with the Velocity Slider in the Piano Roll and Score Inspectors to change its behavior in the same way as the Velocity tool. Holding Option allows velocities for notes to continue to be changed even when other notes have reached there minimum or maximum MIDI velocity value. Option-Shift sets all notes to the same velocity value.
    The Scissors tool now works on arrangement markers.
    It is now possible to drag a Summing Stack into a Folder Stack.
    It is now possible to use the Beat Map feature with a track that has Flex enabled.
    Flex Transient Analysis can now be aborted by pressing Command-period.
    When a Transient Marker is inserted near the position of a previously deleted transient in the Audio File window, the marker will now only snap to the position of the deleted marker if the Option key is pressed while inserting it.
    It is now possible to create more than 32 Folder Track Stacks in a project.
    It is now possible to adjust sliders in the Mixer when controlling Logic via screen sharing, Apple Remote Desktop, or other VNC clients.
    It is now possible to access the Recent Projects menu while the Open Project dialog is active.
    It is now possible to remove the Master Output track from the Tracks area.
    The master track of a Track Stack can now be designated as Groove Master.
    Audio waveforms are now visible under automation on the master track of a Track Stack.
    The Track Import window now shows plug-in preset names.
    When Logic imports Final Cut Pro X XML, it now organizes audio tracks according to their assigned roles in Final Cut Pro.
    Audio is now exported as 24-bit in projects exported to Final Cut Pro X XML.
    When importing XML files that contain multiple projects from Final Cut Pro X 10.1 or later, Logic Pro X now offers a dialog to pick a specific project to import.
    The 1/2 Note head symbol is now available in the the Score Part Box.
    The Catch Playhead button is now available in the Score when the Advanced Tools preference is disabled.
    It is now possible to load ".caf" format files into Space Designer with the Load IR file selector.
    There is now a new key command to trim the start of a region to the end of the previous region in the track.
    There is now a dedicated Piano Roll section in the Key Commands window. This includes commands for "View Mode: One Track," "View Mode: Selected Regions," and Toggle View Mode.
    There is now a key command for “Detect Tempo of Selected Region.”
    There is now a key command for “Adjust Tempo using Beat Mapping Track.”
    The timeline in Logic Remote now changes color to indicate Logic is in Sync mode.
    It is now possible to use the Option key to insert a mono plug-in between two existing plug-ins on a stereo channel strip or vice-versa.
    The Velocity Processor MIDI plug-in now displays note-on as orange dots and note-off events as blue dots in the compression curve window.
    Command-click on a vector point can now be used to modify the times of all subsequent points in the ES2 Vector Envelope.
    The Distortion II plug-in now offers a Distortion Output Level and Mix control.
    Stability
    Logic no longer sometimes quits unexpectedly when:
    Using the Option key to toggle all the disclosure triangles in the Project Audio window.
    Dragging audio from the Project Audio window to the Tracks area.
    Defining custom bank messages for a Multi Instrument in the Environment.
    You insert a blank recordable DVD while Logic is running.
    Changing the audio buffer size while the Audio Editor is open in Flex Pitch mode.
    Selecting a font in the Number & Names panel of the Score preferences.
    Deleting a group in the Project Audio window.
    Undoing a flex edit.
    Using the Glue tool on flex pitched notes after having switched from the Audio File Editor to the Audio Track Editor.
    Performing undo and then redo in quick succession on an EQ in the Smart Controls.
    Performing Undo after deleting a comp or take.
    Closing a song while importing a MIDI file.
    Enabling phase-locked editing on a group.
    Using the Pencil tool in the Audio File editor.
    Importing a long MP4 (AAC) file.
    Changing a channel strip input from stereo to mono.
    Disabling Core Audio.
    Playing a Drummer track while downloading and installing new content.
    Performing undo after certain operations.
    Pasting channel strip settings in the Mixer.
    Dragging a MIDI region over the Score editor.
    Hot-plugging an Apogee Duet to a computer running OS X Mavericks.
    Importing a patch that includes a Track Stack.
    Adding AAC files containing Audio Transport Stream Data (file type “.adts”).
    Performance
    The Channel EQ no longer causes unexpected CPU spikes in live track mode on MacBook Pro with Retina Display.
    Logic no longer becomes less responsive after making several adjustments to the size and/or position of a floating Transport window.
    There is no longer a delay opening the list when clicking in a Send or Output slot on a channel strip.
    Logic no longer becomes less responsive when working for long periods with Flex Pitch.
    The Drummer track now reliably maintains proper timing if it is selected with Low Latency mode enabled.
    Control points in the Transposition track now move more fluidly when edited.
    Scrolling a channel strip fader in the Inspector with a mouse wheel now adjusts its value at the correct resolution.
    Comping takes is now more responsive when Flex Time is enabled.
    Playing a Touch Instrument in Logic Remote no longer sometimes leads to hung notes in Logic Pro X.
    Improves responsiveness when dragging tempo events in the Global tempo track.
    Songs with a very large number of regions now play back as expected.
    Logic’s performance has improved when previewing notes in the Score, Piano Roll, and Event List for regions on a track other than the one selected.
    Multi output Software Instruments with complex routings no longer sometimes cause Logic to become briefly unresponsive when starting playback.
    Logic now reliably creates thumbnails to the end of the video track with long movie files.
    Selecting Channel Strips in very large projects is now faster.
    Improves compatibility with ProRes movie files on OS X Mountain Lion v10.8.5.
    When scrolling over an open Take folder at high zoom levels on OS X Mountain Lion v10.8.5, there are no longer unexpected spikes in CPU usage.
    Automation
    Clicking on an event in the Score no longer sometimes selects the wrong events.
    It is now possible to paste automation at the playhead or marquee selection area rather than only at its original position.
    All MIDI Draw data created by moving track based automation to a Region now appears on the Region and in Piano Roll as expected.
    Volume automation moved from a track to a region is now displayed in the Tracks area MIDI Draw view as expected.
    It is now possible to use MIDI Draw for an event type that does not yet exist in the region.
    When track based automation is moved to a region, the region now immediately switches on MIDI Draw to show the automation in the Track area.
    When region automation is moved to a track, the automation now starts at the beginning of the track.
    MIDI Draw now reliably creates Surround Diversity and Surround Angle fader events in regions.
    It is now possible to make a Marquee selection over region loops when automation is visible.
    MIDI Draw data is no longer shown on additional automation lanes when the main automation lane is set to “Off.”
    MIDI Draw no longer incorrectly displays a ramp between isolated Pitch Bend events.
    When switching between MIDI takes, the MIDI Draw area now properly updates to show the currently selected take.
    Option-clicking a MIDI Draw point again selects all following MIDI Draw points for the region.
    MIDI Draw points inserted with the Pencil are now reliably placed at the clicked position.
    Audio no longer glitches when editing automation while playing back.
    Score
    It is now possible to deselect a voice in the Staff Style window by Command-clicking it.
    The floating Part Box window in the Score no longer shows overlapping elements when first opened.
    Clefs in the Staff Style window now scale properly when viewed on a Retina display.
    Rests in Mapped Drum styles are now correctly positioned with their associated drum groups on the staff.
    When printing a score part with Advanced Tools disabled, Logic no longer prints the track name twice.
    Changing the split point of one voice in a multi-stave Staff Style now properly affects the other voices assigned to the same channel.
    Page view of scores in songs created in Logic 9 now retain their proper paper size when opened in Logic Pro X.
    Scores printed as PDF files now render properly when viewed in Adobe Reader.
    The cursor now reliably shows the correct tools when editing the score in linear display mode.
    It is no longer possible to give a new Score Part Box a name that is already in use by another Part Box.
    The font names for Jazz Cord and Swing Cord fonts now display correctly in the Root Font and Chord Extension Font display in the Chords & Grids panel of the Score settings.
    The staff display in the Staff Style editor now shows the proper key signature for transposed styles.
    It is now possible to change settings for multiple selected staves in the Staff Style edit window at the same time.
    Pasting a compound time signature in the Signature track no longer corrupts the time signature display in the Score.
    Filter buttons on floating part boxes in the Score now remain visible when the part box is resized.
    Tap to click on a trackpad now works with the Pencil tool in the Score.
    It is again possible to insert a bar line at the end of a region in the Score.
    The pencil tool again works in the Score when assigned to the right mouse button.
    In the Score, selected notes in loops now show the selection color.
    The Part box is no longer empty when first opened in a stand-alone Score window after recording.
    The print border no longer sometimes changes unexpectedly when printing to PDF from the Score.
    When Select All is used within a Score Set, the selection is now properly limited to regions within the Score Set.
    Tooltips no longer sometimes obscure the guidelines when inserting elements into the Score.
    The bar positions of SMPTE locked notes now update properly in the Score after the tempo is changed.
    Pressing the Control key now allows for finer granularity when editing Duration Bars in the Score.
    Undo now works after pasting Staff Styles.
    Undo now works after changing the Low or High note value in a Staff Style.
    In page view, the Score now correctly updates to reflect a different paper size selected in the Page Setup window.
    Track names are now reliably shown in Page View when the track contains overlapping regions.
    Drag handles now remain visible at all zoom settings when dragging parts into the Score in linear view mode.
    Adding special bar lines next to added clef or signature changes in linear view mode no longer causes the bar lines and clef or signatures to overlap.
    The mouse cursor now reliably shows the currently active tool in the Score.
    The Score now displays as expected after scrolling vertically at high zoom settings.
    Copy/paste of notes across multiple staves in the Score now works properly.
    Custom colors defined in the Score Layout window are now recalled properly when Logic is relaunched.
    The text cursor is now easier to see in various fields in the Score window.
    The Display Level button in the Score now follows the entire Score hierarchy when an Instrument Set is in use.
    The cursor now displays the Length Change tool when held over the end of a Duration Bar in the Score.
    It is again possible to assign no clef or a drum clef to non-mapped score styles.
    Plug-Ins
    Importing plug-ins to a track no longer unexpectedly changes the input source on the track.
    The pitch of notes held when using Sculpture or ES2 are no longer sometimes shifted when using non-Equal Tempered tunings.
    Moving the Delay slider in the Note Repeater MIDI plug-in while notes are repeating no longer results in hung notes.
    The cycle length in the Arpeggiator plug-in now reliably updates when set to Grid mode.
    Recall Default now works with the Delay Designer plug-in.
    Recall Default now works properly with Audio Unit plug-ins.
    It is now possible to activate bypass on plug-ins that are not currently available.
    When the I/O configuration of a plug-in is changed, its editor no longer opens.
    The timing of multi-output software instruments is now maintained when latency inducing plug-ins like the Ad-Limiter are used on the main output.
    Audio files created by the "Export All Tracks as Audio Files" command now maintain proper sync in projects where high latency plug-ins are used in Summing Stacks.
    The Expander plug-in no longer sometimes introduces audio crackles with certain source signals.
    With Beat Sync disabled, the Course Rate control in the Auto Filter plug-in again behaves as expected.
    Audio now plays reliably from tracks in which there are two Tube Burner pedals inserted in the Pedalboard plug-in.
    VoiceOver now works reliably to activate Smart Controls for the Vintage Clav and Vintage B3 Organ plug-ins.
    Improves the behavior of Smart Controls when used with Voiceover.
    The stand-alone Smart Controls window now properly remembers its last state when reopened.
    When editing vector points in ES2 in loop mode, all envelope values are now properly shown as percentages when the envelope is time-synced.
    Shift-clicking can again be used to insert a vector point in the ES2 Vector Envelope.
    In the ES2 Vector Envelope, the Delete Selected Point contextual menu item again works as expected.
    EXS instruments created in EXS24 MK I no longer exhibit unexpected random velocities when played.
    Logic no longer changes a user-assigned track color when swapping Software Instruments.
    Space Designer’s Filter and Density controls now remain active when the plug-in window is opened more than one time in a session.
    Projects with multiple Ultrabeat instances now play back with reliable timing when the Process Buffer Range is set to Small in the Audio > Devices preferences.
    A plug-in inserted on the 16th slot of an audio channel strip or the 15th slot of a Software Instrument channel strip now remains visible.
    The percussion controls in the Vintage B3 now respond as expected to knob movements from the Native Instruments B4d remote control.
    The mapping of value to position for the Organ sliders in the Smart Controls window is now consistent with the sliders in the Vintage B3 Organ.
    In the Mixer, it is now possible to drag a plug-in from one channel strip to another when there is an External MIDI channel strip between the source and target.
    One shot samples triggered in EXS24 no longer play back with clicks when Rewire Live Mode for Rewire is disabled.
    All plug-in windows now reliably open after changing the order of plug-ins in a channel strip.
    The Scripter plug-in now reliably triggers notes when playing back outside of an active cycle zone.
    The meters in stereo instances of the Adaptive Limiter plug-in now show independent levels for the left and right channels.
    Tuned taps in the Delay Designer plug-in now reliably play in sync.
    Flex
    Flexed regions no longer sometimes show waveforms in the wrong positions.
    Flex Markers no longer unexpectedly change positions when moving them in songs that contain tempo curves.
    Logic no longer sometimes incorrectly shows that an audio region is flexed in songs that contain tempo changes.
    If Flex is enabled, Logic now properly includes manually added transients when an audio region is converted to a sampler track.
    Flex Pitch controls are now available in the Tracks area and Audio Editor immediately after Flex Pitch is enabled for a track and analysis is complete.
    Setting a Flex Mode now applies to all selected tracks.
    It is again possible to cancel flex analysis before it completes.
    The Transposition Track now works with flex-pitched regions.
    Flex mode now gets enabled for all tracks in a group even if Group Clutch enabled.
    The Audio Track editor now reliably shows all notes when scrolling with Flex Pitch enabled.
    Logic no longer sometimes hangs when adjusting notes in Flex Pitch.
    The Flex Pitch grid is now displayed for all takes in the Track Editor even when a Software Instrument track is directly above the selected Audio track.
    Logic now offers the option “Do not show again” in the alert dialog that reads "This region contains inactive flex markers, which will be deleted if you perform the edit."
    If a Flex mode has already been set, clicking the Flex drop-down menu will correctly highlight the currently selected Flex mode.
    When dragging a region from one track to another, the region "Flex and Follow Tempo & Pitch" checkbox settings are now maintained as expected.
    Transient detection is improved with quieter source material.
    When Flex is bypassed on a Take folder, the Follow Tempo checkbox is also now disabled.
    General
    Resolves several issues with Snap introduced in Logic Pro X v10.0.6.
    "Snap to Relative Value" now reliably works at all zoom levels with Smart Snap enabled.
    Adjustments to the left border of a region now use relative snap when that option is enabled.
    When Alignment guides is enabled, Snap to Absolute value now works with Cycle.
    Alignment Guides now work as expected when Snap is set to Off.
    The track icon picker now activates with the first right-click or Control-click.
    Toggling the Tracks Inspector no longer sometimes activates Alignment Guides.
    Logic no longer incorrectly shows an alert that the content must be installed the first time it is launched on computers purchased with Logic pre-installed.
    The Capture as Recording key command no longer creates odd length regions when used in songs with time signatures other than 4/4.
    The Hide Step Input Keyboard key command again works as expected.
    The Nudge Region to Nearest Beat option in the Adjust Tempo using Beat Detection dialog now works as expected.
    The Snip at Playhead Position key command no longer sometimes causes notes in the new righthand region to shift to the beginning of the region.
    Logic Pro X no longer displays the error “Could not open source file” when opening certain MP3 files.
    Logic now properly includes time signature, key signature, and tempo events when moving Arrangement markers.
    Undoing the repositioning of an Arrangement Marker now correctly moves affected automation back to its original position.
    Command-dragging one arrangement marker over another now replaces the previous marker as expected.
    Colors assigned to arrangement markers now take effect as soon as the color is clicked in the Color Box.
    It is now possible to use the Marquee stripe to delete a section within the area encompassed by an Arrangement Marker.
    Using the "Split at Playhead" command on the last arrangement Marker in a song now properly sizes the arrangement marker to the right of the Playhead.
    When an arrangement marker is split, the new marker to the right now maintains the same color and name as the original.
    Arrangement markers can no longer be inadvertently moved by mouse clicks in an empty area of the Arrangement track.
    Copying Arrangement markers no longer creates extra tempo events.
    The Beat Mapping track now continues to display properly when it is resized after other Global tracks have been resized.
    The Beat Mapping Track no longer disappears if Global Tracks are shown while it is already visible.
    Deleting a connection in the Beat Mapping track now correctly also deletes its associated tempo event.
    Tempo events created in the Global Tempo track now reliably display in the Tempo list.
    Setting one track of a phase-locked edit group as Groove Master or Groove Follower now reliably shows all members of the group as being enabled.
    Time signature changes are now reliably displayed in the timeline.
    Logic no longer re-downloads basic content that has already been downloaded by MainStage.
    Arrange Folders now reliably display as expected in the Mixer.
    Double-clicking on the icon for a folder channel strip in the Mixer now opens the folder.
    Commas may now be used as decimal separators when typing values into controls on the Mixer.
    It is now possible to drag regions vertically without an unexpected horizontal shift when "Snap to Grid" is enabled in the Tracks area.
    Recording a new take over multiple existing regions again works as expected.
    It is now possible to create an empty MIDI region on a track hosting an Auxiliary channel strip.
    Shift-click to delete a take selection again works reliably.
    Region Gain now works as expected when applied to comp segments in a Take folder.
    When a take selection is disabled and then re-enabled, the change is now properly reflected in all tracks that are part of the same group.
    Logic no longer unexpectedly re-extends a shortened Take folder when the folder is dragged vertically to a different track.
    When recording in Cycle mode, Logic no longer creates an automatic comp when a take encompasses only part of the Cycle range.
    When regions are packed into a Take folder, regions from the same track are now placed on the same sub-track in the Take folder.
    Fixes an issue in which it was sometimes no longer possible to change the length of a Take folder after performing several other Take folder length edits.
    Take regions no longer unexpectedly shift horizontally when dragged vertically from one sub-track to another when the "Limit Dragging to One Direction In: Tracks" preference is enabled.
    Copied Take folders are no longer missing their contents in certain rare situations.
    Regions on audio tracks inside a folder now are reliably placed on their proper tracks when the folder is unpacked.
    The key command “Select Previous Section for Realtime Comping” now works correctly when used while recording multiple takes in Cycle mode.
    When Bounce-in Place is used with a channel strip that contains a plug-in that performs a mono to stereo conversion, Logic now creates a mono file if the option to bypass plug-ins is selected.
    Regions created with "Bounce in Place" are no longer sometimes given random names.
    Addresses and rare issue that could cause some MIDI notes to play back at the wrong pitch.
    In Link mode, the Piano Roll now reliably shows the contents of the selected region.
    The Event Float window no longer loses focus after a selected note has been edited in the Piano Roll.
    The "Split Events by Playhead" command now works reliably with multiple notes in the Piano Roll.
    Editing notes in the Piano Roll with multiple regions selected no longer sometimes results in notes being inadvertently moved from one region to another.
    Closing the local inspector in the Piano Roll editor no longer leaves a blank area on the right side of the editor.
    Opening MIDI Draw in the Piano Roll no longer offsets the keyboard into the editing area.
    When adding notes in the Piano Roll with the Pencil, newly created notes again have the same Velocity as the last edited note.
    It is now possible to lasso notes in the Piano Roll editor using a Wacom tablet when Logic’s Right Mouse Button

  • 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 :)

  • Indesign 5.5 or 6 + yosemite = production at standstill

    recently I brought into a production of about 25 mixed OS 10.6.8 and 10.9.4 Xeon Mac Pros and i7 iMacs two additional iMacs running Yosemite 10.10
    When the graphic artists who need these systems work on shared InDesign pages the redraw (with multiple layers) is measured in an unresponsive system for at the very least 5 - 10 minutes as opposed to seconds on all the other systems not running Yosemite.
    there are 8 iMacs in the area, all with i7 3.5GHz., GTX 775M 2GB Nvidia cards, 16 GB RAM (directly from Apple)
    Six of them are running Mavricks where this slow behavior simply does not happen., the other two are on OS 10.10.1 where it does. All these computers were unboxed and Adobe CS 5.5 was installed along with the 2014 Java, there was no image involved.
    I am able to reproduce this slowness on the 2.26GHz. Dual Xeon 8GB RAM, 512MB Nvidia, OS 10.10.1 system [see "i have tired the following]" using InDesign CS6
    Upgraded to CC is not an option since I'm not budgeted to upgrade 25 macs on a $2500 a month cost cycle for the foreseeable future, but I am seriously looking at going to Windows.
    I have tired the following:
    Verifying permissions on the Macintosh HD
    Copying the document to a new document on the desktop
    Re-saving the document as a new document to reset the meta-data
    Shutting off all fonts that are not needed.
    under Display Performance
    turing down the display settings in InDesign to "Typical"
    under Preference>Interface:
    unticking all features under Cursor and Gesture options
    unticking all features under Panels
    Setting Hand Tool Performance to minimum (Better Performance)
    Live Screen Drawing is set to Delayed (or None; neither helps)
    Turned pre-flight off all documents.
    all these features are currently running on the systems with Mavericks and they respond quickly even with all of them enabled.
    Is there some way I can downgrade these systems to mavericks or has anyone seen this and found a fix?
    These brand new systems are being outperformed by the 5 year old mac pros they are replacing.

    I've seen behavior like this on InDesign pages that require multiple layers, and it makes no sense at this time
    1) make the layers visible.
    2) drag the selection over an area with multiple items
    3) CMD+Shift+LMB to resize
    the result is Yosemite (on two iMacs and on MacPro Dual Xeon) took almost 10 minutes to complete the resize, there is also a long delay in Mavericks as well which i did not see before since this was reported to me and I watched as 3 different and very experienced InDesign users (two on Yosemite, one on Mavericks all on identical i7 iMacs) showed results where Mavericks was clearly faster in this particular operation.
    When I switch the operation and do step 2 before step 1 the result is the resize takes about 15 - 20 seconds in Mavericks, and slightly longer in Yosemite the first time it's done, however subsequent resizes in Yosemite are subject to the prolonged delay and I can not reproduce a similar delay in Mavericks at this time.
    To further complicate this any non-default setting InDesign to speed up the interface is actually slowing down the entire process with the exception of the view delay which does not perform a redraw during the drag operation.
    When time allows I need to evaluate what's being used in the pages, fonts, images, effects, but my schedule will not allow me to do this either this week or next.

  • Can I translate a layer in fractions of a pixel?

    I'm using a script to iron out slight variations of camera position in a sequence of time-lapse images (the camera movement is caused by daily expansion and contraction of the timber wall that the DSLR is bolted onto).  I've motion-tracked the sequence in another program and produced a file of the translations to be applied to each image, expressed as a number of pixels in X and Y, in floating point numbers.
    The script reads the file into an array, reads in each image, applies the translation (and a number of other transformations such as cropping and scaling) and writes the image out again.
    The script works fine, except that Photoshop rounds the translation to the nearest whole pixel before applying it, which is simply not accurate enough to give a stable sequence. I've tested this in a separate script using a test image, and hard-wiring the translation values directly into the function call, and confirmed that it only seems possible to move a raster layer in Photoshop in whole pixels, regardless of whether snap-to-pixel is disabled, and regardless of the zoom level.
    The workaround is obviously to scale the image up each time - say 5 or 10 times - apply a scaled translation - and then scale it down again - but I thought I'd see if I was being stupid and missing something trivial first!
    P.S I've tried Auto-align, but with limited success - with changing shadows and sunlight, and moving branches etc, it often gets confused.

    Just in case anyone else with a similar problem stumbles on this thread, here's what transpired:
    After deciding on the scale-up/scale-down method to get 0.2 pixel accuracy on translation, I needed to rotate the images by small amounts to line everything up. That's when I found that the 'rotate' function in Photoshop has a similar problem - it only seems to work to one decimal place (for a layer) or two (for the whole image).  On a 3000-pixel-wide image the rounding errors produce a jitter in the animated sequence.  Of course with rotation, upscaling and downscaling don't help - an angle is an angle whatever size the image is. So, back to the drawing board....
    I finally solved the issue by avoiding Photoshop altogether for this particular exercise.  I wrote my own program (in VB.NET) to process the images - the .NET environment provides matrix functions to shift images by amounts down to .0000001 of a pixel (or whatever the smallest 32-bit floating point number is!) and to rotate and scale with the same accuracy. There's no need to upscale & downscale, so the program works fast - less than a second per frame to load, shift, rotate, crop, resize, rotate 180,  and save.  The results are indistinguishable in quality from those produced by the Photoshop script, and the time-lapse sequence is now rock-steady.  Hooray!

  • How do I crop in a circle?

    I just downloaded the trial version of Elements 9. I have had no formal training on the program at all. I want to crop some photos into a circle, but I can't figure out how! Can you help?

    There are many ways to crop. Here is one which offers lots of flexibility. No doubt other readers of this forum will offer other suggestions.
    Your picture when loaded into PSE has the default layer named "Background". First thing is to convert it to regular layer by renaming it; double-click it and enter the new name or simply accept the default name "Layer 0".
    Next, active the Elipse tool.  Holding down Shift, draw out a circle approximately the size you want (Shift forces the ellipse to be a circle). This creates a new layer named "Shape 1". Don't worry that the circle is a solid color and not in the exact size and position you want; we will fix this is a moment.
    Move the shape layer below the picture layer and group the 2 layers.The picture will now be cropped into the circle, with a checkerboard background indicating transparency:
    The nice thing about this method is that you can now resize and reposition the picture precisely where you want it within the crcle.  Select the Move Tool and with either layer activated use the mouse and/or arrow keys to reposition the picture. To resize the circle, with the Move tool selected activate the picture layer and while holding Shift drag any of the corner handles to resize (Shift preserves the circle). If you want to reposition the circle-picture combination within the picture's canvas, link the 2 layers and use the Move tool with mouse or arrow keys.
    If the picture is to be used for an application that requires transparency (such as MS Word document, Web page, greeting card program), save it in a file type that supports transparency. PSD, TIFF, PNG, GIF, EPS support transparency.  JPG, BMP do not. If you save it as jpg for example, you will not have transparency but instead a white background (which is maybe what you wanted in the first place). If you want a different color background add a blank layer at the bottom of the stack and fill it with your color:
    Like I said, there are other (and easier) ways to crop but this offers the flexibility of resizing and positioning.

Maybe you are looking for