Tool bar dock problem with grid layout

I have a tool bar with grid layout. When i dock it to vertical location(west or east) the buttons inside tool bar keep one row. I want to know how do i do to make the buttons arraged vertically like the tool bar with default layout when dock it at west or east position.

I had started a custom layout manager for toolbars a few months ago that I found a little easier to use than the default BoxLayout. I just modified it to allow optionally matching the button sizes (width, height, or both), so you can get the same effect as GridLayout. Note that this one doesn't collapse the toolbar like the one in the other thread. Here's the source code as well as a simple test app to demonstrate how to use it. Hope it helps.
//     TestApp.java
//     Test application for ToolBarLayout
// package ***;
import java.awt.*;
import javax.swing.*;
public class TestApp extends JFrame
     /////////////////////// Main Method ///////////////////////
     public static void main(String[] args)
          try { UIManager.setLookAndFeel(
               UIManager.getSystemLookAndFeelClassName()); }
          catch(Exception ex) { }     
          new TestApp();
     public TestApp()
          setTitle("ToolBarLayout Test");
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          setSize(400, 300);
          setLocationRelativeTo(null);
          JToolBar tbar = new JToolBar();
          ToolBarLayout layout = new ToolBarLayout(tbar);
          // Comment these two lines out one at a time to see
          // how they affect the toolbar's layout...
          layout.setMatchesComponentDepths(true);
          layout.setMatchesComponentLengths(true);
          tbar.setLayout(layout);
          tbar.add(new JButton("One"));
          tbar.add(new JButton("Two"));
          tbar.add(new JButton("Three"));
          tbar.addSeparator();
          tbar.add(new JButton("Musketeers"));
          Container c = getContentPane();
          c.setLayout(new BorderLayout());
          c.add(tbar, BorderLayout.NORTH);
          setVisible(true);
//     ToolBarLayout.java
//     A simple layout manager for JToolBars.  Optionally resizes buttons to
//     equal width or height based on the maximum preferred width or height
//     of all components.
// package ***;
import java.awt.*;
import javax.swing.*;
public class ToolBarLayout implements LayoutManager, SwingConstants
     private JToolBar     oToolBar = null;
     private boolean     oMatchDepth = false;
     private boolean     oMatchLength = false;
     private int          oGap = 0;
     public ToolBarLayout(JToolBar toolBar)
          oToolBar = toolBar;
     public ToolBarLayout(JToolBar toolBar, boolean matchDepths)
          oToolBar = toolBar;
          oMatchDepth = matchDepths;
     public ToolBarLayout(JToolBar toolBar,
                    boolean matchDepths,
                         boolean matchLengths)
          oToolBar = toolBar;
          oMatchDepth = matchDepths;
          oMatchLength = matchLengths;
     // If true, all buttons in the row will be sized to
     // the same height (assuming horizontal orientation)
     public void setMatchesComponentDepths(boolean match)
          oMatchDepth = match;
     // If true, all buttons in the row will be sized to
     // the same width (assuming horizontal orientation)
     public void setMatchesComponentLengths(boolean match)
          oMatchLength = match;
     public void setSpacing(int spacing)
          oGap = Math.max(0, spacing);
     public int getSpacing()
          return oGap;
     ////// LayoutManager implementation //////
     public void addLayoutComponent(String name, Component comp) { }
     public void removeLayoutComponent(Component comp) { }
     public Dimension minimumLayoutSize(Container parent)
          return preferredLayoutSize(parent);
     public Dimension preferredLayoutSize(Container parent)
          synchronized (parent.getTreeLock())
               int orientation = getOrientation();
               Component[] components = parent.getComponents();
               int w = 0, h = 0;
               int totalWidth = 0, totalHeight = 0;
               int maxW = getMaxPrefWidth(components);
               int maxH = getMaxPrefHeight(components);
               Dimension ps = null;
               if (orientation == HORIZONTAL)
                    for (int i=0; i < components.length; i++)
                         ps = components.getPreferredSize();
                         if (oMatchLength) w = maxW;
                         else w = ps.width;
                         if (oMatchDepth) h = maxH;
                         else h = ps.height;
                         if (components[i] instanceof JSeparator)
                              w = ps.width;
                              h = 0;
                         totalWidth += w;
                         if (i < components.length - 1)
                                   totalWidth += oGap;
                         totalHeight = Math.max(totalHeight, h);
               else
                    for (int i=0; i < components.length; i++)
                         ps = components[i].getPreferredSize();
                         if (oMatchDepth) w = maxW;
                         else w = ps.width;
                         if (oMatchLength) h = maxH;
                         else h = ps.height;
                         if (components[i] instanceof JSeparator)
                              w = 0;
                              h = ps.height;
                         totalHeight += h;
                         if (i < components.length - 1)
                                   totalHeight += oGap;
                         totalWidth = Math.max(totalWidth, w);
               Insets in = parent.getInsets();
               totalWidth += in.left + in.right;
               totalHeight += in.top + in.bottom;
               return new Dimension(totalWidth, totalHeight);
     public void layoutContainer(Container parent)
          synchronized (parent.getTreeLock())
               int orientation = getOrientation();
               Component[] components = parent.getComponents();
               Insets in = parent.getInsets();
               int x = in.left, y = in.top;
               int w = 0, h = 0, maxW = 0, maxH = 0;
               Dimension ps = null;
               if (orientation == HORIZONTAL)
                    maxW = getMaxPrefWidth(components);
                    maxH = Math.max( getMaxPrefHeight(components),
                         parent.getHeight() - in.top - in.bottom );
                    for (int i=0; i < components.length; i++)
                         ps = components[i].getPreferredSize();
                         if (oMatchLength) w = maxW;
                         else w = ps.width;
                         if (oMatchDepth) h = maxH;
                         else h = ps.height;
                         if (components[i] instanceof JSeparator)
                              w = ps.width;
                              h = maxH;
                         components[i].setBounds(
                              x, y + (maxH-h)/2, w, h);
                         x += w + oGap;
               else
                    maxH = getMaxPrefHeight(components);
                    maxW = Math.max( getMaxPrefWidth(components),
                         parent.getWidth() - in.left - in.right );
                    for (int i=0; i < components.length; i++)
                         ps = components[i].getPreferredSize();
                         if (oMatchDepth) w = maxW;
                         else w = ps.width;
                         if (oMatchLength) h = maxH;
                         else h = ps.height;
                         if (components[i] instanceof JSeparator)
                              w = maxW;
                              h = ps.height;
                         components[i].setBounds(
                              x + (maxW-w)/2, y, w, h);
                         y += h + oGap;
     //// private methods ////
     private int getOrientation()
          if (oToolBar != null) return oToolBar.getOrientation();
          else return HORIZONTAL;
     private int getMaxPrefWidth(Component[] components)
          int maxWidth = 0;
          int componentWidth = 0;
          Dimension d = null;
          for (int i=0; i < components.length; i++)
               d = components[i].getPreferredSize();
               componentWidth = d.width;
               if (components[i] instanceof JSeparator)
                    componentWidth = Math.min(d.width, d.height);
               maxWidth = Math.max(maxWidth, componentWidth);
          return maxWidth;
     private int getMaxPrefHeight(Component[] components)
          int maxHeight = 0;
          int componentHeight = 0;
          Dimension d = null;
          for (int i=0; i < components.length; i++)
               d = components[i].getPreferredSize();
               componentHeight = d.height;
               if (components[i] instanceof JSeparator)
                    componentHeight = Math.min(d.width, d.height);
               else maxHeight = Math.max(maxHeight, componentHeight);
          return maxHeight;

Similar Messages

  • Problem with Grid Layouts

    I have problems getting the children to span correctly in grid components. I have set a grid to contain 7 children and set the width of all to 100%. Yet they have varying widths.

    The code should read:
    setLayout( new GridLayout(3, 1) );Note the capital L in layout.

  • Stacked 100% bar chart - Problem with datatips for zero value data points

    I have a stacked 100% bar chart that shows datatips in Flex 4.   However, I don't want it to show datatips for
    data points with zero values.   Flex 4 shows the datatip for a zero value data point on the left side of a bar if the data point is not the first in the series.
    Here's the code that illustrates this problem.    Of particular concern is the July bar.    Because of the zero value data point problem, it's not possible to see the datatip for "aaa".
    Any ideas on how we can hide/remove the datatips for zero value data points ?        Thanks.
    <?xml version="1.0"?>
    <s:Application
    xmlns:fx="
    http://ns.adobe.com/mxml/2009"xmlns:mx="
    library://ns.adobe.com/flex/mx"xmlns:s="
    library://ns.adobe.com/flex/spark"creationComplete="initApp()"
    height="
    1050" width="600">
    <s:layout>
    <s:VerticalLayout/>
    </s:layout>
    <fx:Script><![CDATA[ 
    import mx.collections.ArrayCollection;[
    Bindable] 
    private var yearlyData:ArrayCollection = new ArrayCollection([{month:
    "Aug", a:1, b:10, c:1, d:10, e:0},{month:
    "July", a:1, b:10, c:10, d:10, e:0},{month:
    "June", a:10, b:10, c:10, d:10, e:0},{month:
    "May", a:10, b:10, c:10, d:0, e:10},{month:
    "April", a:10, b:10, c:0, d:10, e:10},{month:
    "March", a:10, b:0, c:10, d:10, e:10},{month:
    "February", a:0, b:10, c:10, d:10, e:10},{month:
    "January", a:10, b:10, c:10, d:10, e:10}]);
    private function initApp():void {}
    ]]>
    </fx:Script>
    <s:Panel title="Stacked Bar Chart - Problems with DataTips for Zero Value Items" id="panel1">
    <s:layout>
    <s:HorizontalLayout/>
    </s:layout>
    <mx:BarChart id="myChart" type="stacked"dataProvider="
    {yearlyData}" showDataTips="true">
    <mx:verticalAxis>
     <mx:CategoryAxis categoryField="month"/>
     </mx:verticalAxis>
     <mx:series>
     <mx:BarSeries
    xField="a"displayName="
    aaa"/>
     <mx:BarSeries
    xField="b"displayName="
    bbb"/>
     <mx:BarSeries
    xField="c"displayName="
    ccc"/>
     <mx:BarSeries
    xField="d"displayName="
    ddd"/>
     <mx:BarSeries
    xField="e"displayName="
    eee"/>
     </mx:series>
     </mx:BarChart>
     <mx:Legend dataProvider="{myChart}"/>
     </s:Panel>
     <s:RichText width="700">
     <s:br></s:br>
     <s:p fontWeight="bold">The problem:</s:p>
     <s:p>Datatips for zero value data points appear on left side of bar (if data point is not the first point in series).</s:p>
     <s:br></s:br>
     <s:p fontWeight="bold">For example:</s:p>
     <s:p>1) For "June", eee = 0, mouse over the left side of the bar to see a datatip for "eee". Not good.</s:p>
     <s:br></s:br>
     <s:p>2) For "July", eee = 0 and aaa = 1, can't see the datatip for "aaa", instead "eee" shows. Real bad.</s:p>
     <s:br></s:br>
     <s:p>3) For "Feb", aaa = 0, datatip for "aaa" (first point) does not show. This is good.</s:p>
     <s:br></s:br>
     <s:p>4) For "Mar", bbb = 0, datatip for "bbb" shows on the left side of the bar. Not good.</s:p>
     <s:br></s:br>
     <s:p fontWeight="bold">Challenge:</s:p>
     <s:p>How can we hide/remove datatips for zero value data points?</s:p>
     <s:br></s:br>
     </s:RichText></s:Application>

    FYI.
    Still have the issue after upgrading to the latest Flex Builder 4.0.1 with SDK 4.1.0 build 16076.   
    Posted this as a bug in the Adobe Flex Bug and Issue Management system.     JIRA
    http://bugs.adobe.com/jira/browse/FLEXDMV-2478
    Which is a clone of a similar issue with Flex 3 ...
    http://bugs.adobe.com/jira/browse/FLEXDMV-1984

  • Problems with the Layout Priority in KM

    Hello, I have some problems with the Layout Priority in KM..
    I'm using a KM Navigation Iview with "<i>Layout Set</i>"=NewsBrowser (this Layout Set uses a Collection renderer that sorts the folder's contents by "last modified") and "<i>Layout Set Mode</i>"=exclusive.
    In the KM folder I setted in <i>Details->Settings->Presentation</i> as "<u>rndSortProperty</u>"=name because I need to order my files by FileName property.
    Despite that in see that the contents showed in my iview are ordered by Last Modified...
    The "<i>Layout Set Mode</i>" exclusive gives the higher priority to the Folder Settings..
    I don't understand..
    Thank you in advance.

    Thank you Shyja,
    your post was helpful, but another issue is occurred.
    Maybe en example could be useful..
    My scenario:
    - I need to show a km folder with layout set "<i>ConsumerExplorer</i>" on root folder (no "property of sorting" setted on its collection renderer) and "<i>TabExplorer</i>" (no "property of sorting" setted on its collection renderer).
    - I need to sort files and folders by "last modified". By default seems that they are sorted by "name".
    - With my administrator user I open my folder details (in Content Admin->KM Content is used the Layout "<i>AdminExplorer</i>"), and in "Settings->Presentation->Additional Parameters" I add two parameters "<i>rndSortOrder</i>=descending" and "<i>rndSortProperty</i>=modified" (the others are parameters of AdminExplorer Layout).
    - Then I check "Apply Settings to All Subfolders" and "Use Settings for All iViews (Preferred Presentation)".
    result:
    I see the "<i>ConsumerExplorer</i>" on root folder, the subfolder are sorted by "last modified" (everything ok).
    I click on a subfolder, the "TabExplorer" si showed, the Tabs and the content are sorted by "last modified" BUT..
    .. into the tabs are showed <u>nameFolders</u> (in link style), <u>the action command</u>, and the properties of "<u>author</u>" and "<u>last modified</u>" (normally into the tabs are showed just the folderNames in text style)...
    Why?? Is possible that the "AdminExplorer" parameters of the km folder affect the Tab component??
    Thank you

  • I just bought new iPhone 5 - when I try to reply to e-mail my tool bar at bottom with "reply, forward, delete..." is not there!  Why? How can I reactivate it?

    I just bought new iPhone 5 - when I try to reply to e-mail my tool bar at bottom with "reply, forward, delete..." is not there!  Why? How can I reactivate it?

    Submit suggestions to Apple at http://www.apple.com/feedback/iphone.html

  • Problems with Overlay Layout - can anyone spot something wrong/missing?

    Hi folks, I'm developing a tool that allows you to draw rectangles around objects on an image. The rectangles are then saved, and you can move between images. For some reason, though my rectangles are not drawing on the panel. I am using the Overlay Layout. Can anyone spot what I'm doing wrong? (The TopPanel canvas appears to be there, as it's taking input from the mouse - the problem is simply that the red rectangles are not drawing on the panel). Please help!!
    So you know, there is a JFrame in another class which adds an instance of the ObjectMarker panel to it. It also provides buttons for using the next and previous Image methods.
    Any other general advice is appreciated too.
    * Object_Marker.java
    * Created on 07 April 2008, 15:38
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
    import java.awt.event.MouseEvent;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import java.util.Arrays;
    import java.util.Collections;
    import java.util.HashMap;
    import java.util.LinkedList;
    import java.util.List;
    import javax.imageio.ImageIO;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.OverlayLayout;
    import javax.swing.event.MouseInputAdapter;
    * @author Eric
    public class ObjectMarker extends javax.swing.JPanel {
         private static final long serialVersionUID = 6574271353772129556L;
         File directory;
         String directory_path;
         Font big = new Font("SansSerif", Font.BOLD, 18);
         List<File> file_list = Collections.synchronizedList(new LinkedList<File>());
         String[] filetypes = { "jpeg", "jpg", "gif", "bmp", "tif", "tiff", "png" };
         // This Hashmap contains List of Rectangles, allowing me to link images to collections of rectangles through the value 'index'.
         public static HashMap<Integer, List<Rectangle>> collection = new HashMap<Integer, List<Rectangle>>();
         BufferedImage currentImage;
         Thread thread;
         Integer index = 0;
         OverlayLayout overlay;
         private TopPanel top;
         private JPanel pictureFrame;
         String newline = System.getProperty("line.separator");
          * Creates new form Object_Marker
          * @throws IOException
         public ObjectMarker(File directory) {
              System.out.println("Got in...");
              this.directory = directory;
              File[] temp = directory.listFiles();
              directory_path = directory.getPath();
              // Add all the image files in the directory to the linked list for easy
              // iteration.
              for (File file : temp) {
                   if (isImage(file)) {
                        file_list.add(file);
              initComponents();
              try {
                   currentImage = ImageIO.read(file_list.get(index));
              } catch (IOException e) {
                   System.out.println("There was a problem loading the image.");
              // 55 pixels offsets the height of the JMenuBar and the title bar
              // which are included in the size of the JFrame.
              this.setSize(currentImage.getWidth(), currentImage.getHeight() + 55);
         public String getImageList() {
              // Allows me to build the string gradually.
              StringBuffer list = new StringBuffer();
              list.append("Image files found in directory: \n\n");
              for (int i = 0; i < file_list.size(); i++) {
                   list.append((((File) file_list.get(i))).getName() + "\n");
              return list.toString();
         private void initComponents() {
              top = new TopPanel();
              pictureFrame = new javax.swing.JPanel();
              OverlayLayout ol = new OverlayLayout(this);
              this.setLayout(ol);
              this.add(top);
              this.add(pictureFrame);
          * private void initComponents() {
          * javax.swing.GroupLayout pictureFrameLayout = new
          * javax.swing.GroupLayout(pictureFrame);
          * pictureFrame.setLayout(pictureFrameLayout);
          * pictureFrameLayout.setHorizontalGroup(
          * pictureFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          * .addGap(0, 497, Short.MAX_VALUE) ); pictureFrameLayout.setVerticalGroup(
          * pictureFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          * .addGap(0, 394, Short.MAX_VALUE) );
          * javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
          * this.setLayout(layout); layout.setHorizontalGroup(
          * layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          * .addComponent(pictureFrame, javax.swing.GroupLayout.DEFAULT_SIZE,
          * javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) );
          * layout.setVerticalGroup(
          * layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          * .addComponent(pictureFrame, javax.swing.GroupLayout.DEFAULT_SIZE,
          * javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); }
          * This function returns the extension of a given file, for example "jpg" or
          * "gif"
          * @param f
          *            The file to examine
          * @return String containing extension
         public static String getExtension(File f) {
              String ext = null;
              String s = f.getName();
              int i = s.lastIndexOf('.');
              if (i > 0 && i < s.length() - 1) {
                   ext = s.substring(i + 1).toLowerCase();
              } else {
                   ext = "";
              return ext;
         public String getDetails() {
              saveRectangles();
              StringBuffer sb = new StringBuffer();
              for (int i = 0; i < file_list.size(); i++) {
                   try{
                   int count = collection.get(i).size();
                   if (count > 0) {
                        sb.append(file_list.get(i).getPath() + " "); // Add the
                        // filename of
                        // the file
                        sb.append(count + " "); // Add the number of rectangles
                        for (int j = 0; j < collection.get(i).size(); j++) {
                             Rectangle current = collection.get(i).get(j);
                             String coordinates = (int) current.getMinX() + " "
                                       + (int) current.getMinY() + " ";
                             String size = ((int) current.getMaxX() - (int) current
                                       .getMinX())
                                       + " "
                                       + ((int) current.getMaxY() - (int) current
                                                 .getMinY()) + " ";
                             String result = coordinates + size;
                             sb.append(result);
                        sb.append(newline);
                   } catch (NullPointerException e){
                        // Do nothing.  "int count = collection.get(i).size();"
                        // will try to over count.
              return sb.toString();
         private boolean isImage(File f) {
              List<String> list = Arrays.asList(filetypes);
              String extension = getExtension(f);
              if (list.contains(extension)) {
                   return true;
              return false;
         /** Draw the image on the panel. * */
         public void paint(Graphics g) {
              if (currentImage == null) {
                   g.drawString("No image to display!", 300, 240);
              } else {
                   // Draw the image
                   g.drawImage(currentImage, 0, 0, this);
                   // Write the index
                   g.setFont(big);
                   g.drawString(index + 1 + "/" + file_list.size(), 10, 25);
         public void nextImage() throws IOException {
              if (index < file_list.size() - 1) {
                   printOutContents();
                   System.out.println("Index: " + index);
                   saveRectangles();
                   index++;
                   currentImage = ImageIO.read(file_list.get(index));
                   this
                             .setSize(currentImage.getWidth(),
                                       currentImage.getHeight() + 55);
                   top.setSize(this.getSize());
                   top.rectangle_list.clear();
                   if (collection.size() > index) {
                        loadRectangles();
                   repaint();
         private void saveRectangles() {
              // If the current image's rectangles have not been changed, don't do
              // anything.
              if (collection.containsKey(index)) {
                   System.out.println("Removing Index: " + index);
                   collection.remove(index);
              collection.put(index, top.getRectangleList());
              System.out.println("We just saved " + collection.get(index).size()
                        + " rectangles");
              System.out.println("They were saved in HashMap Location " + index);
              System.out.println("Proof: ");
              List<Rectangle> temp = collection.get(index);
              for (int i = 0; i < temp.size(); i++) {
                   System.out.println("Rectangle " + (i + 1) + ": " + temp.get(i));
              // If the rectangle list has changed, set the list the current index
              // as the new list.
         private void loadRectangles() {
              System.out.println("We just loaded index " + index
                        + " into temporary memory.");
              System.out.println("Proof: ");
              List<Rectangle> temp = collection.get(index);
              top.rectangle_list = collection.get(index);
              for (int i = 0; i < temp.size(); i++) {
                   System.out.println("Rectangle " + (i + 1) + ": " + temp.get(i));
         private void printOutContents() {
              System.out.println();
              System.out.println("Contents printout...");
              for (int i = 0; i < collection.size(); i++) {
                   for (Rectangle r : collection.get(i)) {
                        System.out.println("In collection index: " + i + " Rectangle "
                                  + r.toString());
              System.out.println();
         public void previousImage() throws IOException {
              if (index >= 1) {
                   printOutContents();
                   System.out.println("Index: " + index);
                   saveRectangles();
                   index--;
                   currentImage = ImageIO.read(file_list.get(index));
                   this
                             .setSize(currentImage.getWidth(),
                                       currentImage.getHeight() + 55);
                   top.setSize(this.getSize());
                   top.rectangle_list.clear();
                   if (index >= 0) {
                        loadRectangles();
                   repaint();
         public void removeLastRectangle() {
              // This method removes the most recent rectangle added.
              try {
                   int length = collection.get(index).size();
                   collection.get(index).remove(length - 1);
              } catch (NullPointerException e) {
                   try {
                        top.rectangle_list.remove(top.rectangle_list.size() - 1);
                   } catch (IndexOutOfBoundsException ioobe) {
                        JOptionPane.showMessageDialog(this, "Cannot undo any more!");
    * Class developed from SSCCE found on Java forum:
    * http://forum.java.sun.com/thread.jspa?threadID=647074&messageID=3817479
    * @author 74philip
    class TopPanel extends JPanel {
         List<Rectangle> rectangle_list;
         private static final long serialVersionUID = 6208367976334130998L;
         Point loc;
         int width, height, arcRadius;
         Rectangle temp; // for mouse ops in TopRanger
         public TopPanel() {
              setOpaque(false);
              rectangle_list = Collections
                        .synchronizedList(new LinkedList<Rectangle>());
              TopRanger ranger = new TopRanger(this);
              addMouseListener(ranger);
              addMouseMotionListener(ranger);
         public List<Rectangle> getRectangleList() {
              List<Rectangle> temporary = Collections
                        .synchronizedList(new LinkedList<Rectangle>());
              temporary.addAll(rectangle_list);
              return temporary;
         protected void paintComponent(Graphics g) {
              super.paintComponent(g);
              Graphics2D g2 = (Graphics2D) g;
              g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
              g2.setPaint(Color.red);
              // Draw all the rectangles in the rectangle list.
              for (int i = 0; i < rectangle_list.size(); i++) {
                   g2.drawRect(rectangle_list.get(i).x, rectangle_list.get(i).y,
                             rectangle_list.get(i).width, rectangle_list.get(i).height);
              if (temp != null) {
                   g2.draw(temp);
         public void loadRectangleList(List<Rectangle> list) {
              rectangle_list.addAll(list);
         public void addRectangle(Rectangle r) {
              rectangle_list.add(r);
    class TopRanger extends MouseInputAdapter {
         TopPanel top;
         Point offset;
         boolean dragging;
         public TopRanger(TopPanel top) {
              this.top = top;
              dragging = false;
         public void mousePressed(MouseEvent e) {
              Point p = e.getPoint();
              top.temp = new Rectangle(p, new Dimension(0, 0));
              offset = new Point();
              dragging = true;
              top.repaint();
         public void mouseReleased(MouseEvent e) {
              dragging = false;
              // update top.r
              System.out.println(top.getRectangleList().size() + ": Object added: "
                        + top.temp.toString());
              top.addRectangle(top.temp);
              top.repaint();
         public void mouseDragged(MouseEvent e) {
              if (dragging) {
                   top.temp.setBounds(top.temp.x, top.temp.y, e.getX() - top.temp.x, e
                             .getY()
                             - top.temp.y);
                   top.repaint();
    }Regards,
    Eric

    Alright so I fixed it! I created a new class called BottomPanel extends JPanel, which I then gave the responsibility of drawing the image. I gave it an update method which took the details of the currentImage and displayed it on the screen.
    If anybody's interested I also discovered/solved a problem with my mouseListener - I couldn't drag backwards. I fixed this by adding tests looking for negative widths and heights. I compensated accordingly by reseting the rectangle origin to e.getX(), e.getY() and by setting the to original_origin.x - e.getX() and original_origin.y - e.getY().
    No problem!

  • Problem with view layout

    I'm working web dynpro for ABAP trying to duplicate a legacy system screen.
    I have 3 different types of addresses to display on the screen - Shipping, Billing, and Mailing.  What I want to do is arrange these addresses in 3 columns.  Each column would have the heading indicating the address type and would contain the fields for that address type.
    I have tried the matrix layout and don't seem to be able to control the number of columns on the screen. Each time I add an element it gets tacked on horizontally just like typing.  What I want to do is work vertically withing a column building the elements.
    I'm fumbling around with the grid layout now but I'm still having trouble arranging the fields the way I want.
    Is there an easier way to accomplish this?
    Thanks,
    Brent

    Hi Sergei,
    Thanks for the tip.  That solved my vertical allignment problem but I'm still fighting with trying to get multiple elements within a cell in the Matrix.
    If I set the layout property of field A to MatrixHeadData and then add field B and C it looks like this.
    A     B     C
    If I add field D and set the property to MatrixHeadData then that starts a new row with D and it looks like this;
    A     B     C
    D
    I'm still having trouble putting multiple elements in the same cell like this
    A     D
    B
    C
    It seems odd that you can't just move fields around on the screen with the mouse or create a matrix and then just drag and drop field into the various cells.  Am I going about this the hard way?
    Thanks
    Brent

  • Problem with pages layout

    Hi, iam using last version of Firefox and WinXP sp3. Sometimes all works good, but sometimes something freaks out and youtube page looks like this
    I didnt notice anything like that on other sites, plus i cant see any regularity in this thing BUT sometimes sites which host videos (like youtube itself) give me message about lack of adobe flash player (and if this happens, all sites with this flash windows of video player doesnt work). I tried to reinstall it many times already and also, this thing happens in ALL browsers for me. I checked it with latest versions of Chrome and Opera, plus some old IE, not sure which version it is. I tried to reinstall browsers as well, but no luck. Iam thinking about some viruses, but i already checked it with nod32 and avast, and they found few viruses, but after cleaning up problem didnt get fixed. What can i do except of reinstalling OS? Maybe another antivirus? This started to happen really sudden, i didnt install any drivers or progs before. Please, give me advice, iam pretty sure there are solution.

    Hi, thank you for the screenshot and Flash file info. Your Flash files are correct, both for Internet Explorer and Firefox.
    Using IE, go to Tools, manage add ons, Toolbars & Extensions. At the bottom look for Show all add ons. Now look for Shockwave Flash Object...ActiveX Control...Flash10h.ocx and make sure it is Enabled.
    Then using FF(Firefox) in the plug-ins find the SWF version 10.1.53.64 plug-in and make sure it is Enabled.
    Let me know on both of those.
    There is a feature in the Flash Player 10.1 called hardware acceleration and it is turned ON by default. Many users are having problem with videos and turning this off. Go to youtube and bring up any video and as soon as it starts, right click on the video and this should open a Display Setting. UN check the hardware acceleration.
    It is also recommended to update the graphic and video drivers to the latest versions. If your drivers are up to date, you may only need to turn off the hardware acceleration.
    Let me know.
    Thanks,
    eidnolb

  • Dock problems with mighty mouse

    I keep the hiding on for the Dock and have never had any issue with it. Since installing and using the wireless mighty mouse, I can only get the dock to pop out about 50% of the time. It's getting quite tiring to keep having to reach for the trackpad half the time I want to access the dock. Any ideas? (I've already checked for software updates) Anyone else have this odd problem?
    I was also having a problem with right clicking until I read in another thread that I had to lift my left finger off the mouse. Awkward, but working fine. Thanks to whomever posted that advice.
    1.5 GHz PowerBook G4   Mac OS X (10.4.7)  

    Hi CharPatton;
    Generally failure to scroll down with the ball on a Mighty Mouse is an indication of a dirty ball. To clean the ball you can turn the mouse upside down and roll the ball on a chamois cloth in large circles. If the ball is really dirty and the circles on chamois cloth are now able to clean, take a tissue with a little bit of alcohol on and do the circling motion on the tissue then repeat once more on the chamois cloth. Hopefully that should do it for you.
    Allan

  • My Firefox Browser tool bar ( ... with the buttons "Bookmarks"," History", "Tools". etc, ) has disappeared -- how can i restore it ?

    I access the internet through the Mozilla Firefox browser with a "toolbar"that was originally as described above. My default "home page " is the AOL web site through which I access e-mail . AOL offered a" toolbar" -- I installed it and '''several days later'''the top "bar " on my computer changed to read " Aol - Mozilla Firefox, etc., .... " but with "the buttons " ---" Bookmarks , History , Tools, ...etc. " ---gone . The " Aol Toolbar " is the next" band " down . How do I restore the original configuration ? Can I have two such " tool bars" ? I'd be happy with just the "original ". Thanks --- Hhutson 1

    '''''"Bookmarks"," History", "Tools". etc''''': Those are on the Menu Bar; see below
    '''<u>Menu Bar</u>''' (File, Edit, View, History, Bookmarks, Tools, Help)<br /> Firefox 3.6.x versions allow the user to hide the Menu Bar.<br />
    *Tap the ALT key or the F10 key, Menu Bar will display, click View, click Toolbars, click Menu Bar to place a check mark next to it, '''''OR'''''
    *Press and hold the ALT key while pressing the letters VTM on your keyboard, then release the ALT key
    *See: http://support.mozilla.com/en-US/kb/Menu+bar+is+missing
    '''<u>Other Toolbars</u>''', see: https://support.mozilla.com/en-US/kb/Back+and+forward+or+other+toolbar+items+are+missing<br />
    '''<u>Status Bar</u>''': click View, click Status Bar to place a check mark<br />
    '''<u>Full Screen Mode</u>''': If you have no Toolbars or Tab Bar: Press F11 (F11 is an on/off toggle). See: http://kb.mozillazine.org/Netbooks#Full_screen<br />
    Also see: http://kb.mozillazine.org/Toolbar_customization_-_Firefox#Restoring_missing_menu_or_other_toolbars
    '''Other issues needing your attention'''
    The information submitted with your question indicates that you have out of date plugins with known security and stability issues that should be updated. To see the plugins submitted with your question, click "More system details..." to the right of your original question post. You can also see your plugins from the Firefox menu, Tools > Add-ons > Plugins.<br />
    <br />
    *Adobe PDF Plug-In For Firefox and Netscape
    **'''''Current versions are 9.2.4 and 10.0.1, both security releases on 2011-02-08'''''
    **Info on version 10 (Reader X):
    ***New Adobe Reader X (version 10) with Protected Mode was released 2010-11-19
    ***See: http://www.securityweek.com/adobe-releases-acrobat-reader-x-protected-mode
    #'''Check your plugin versions''': http://www.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    '''Update Adobe Reader (PDF plugin):'''
    #*From within your existing Adobe Reader ('''<u>if you have it already installed</u>'''):
    #**Open the Adobe Reader program from your Programs list
    #**Click Help > Check for Updates
    #**Follow the prompts for updating
    #**If this method works for you, skip the "Download complete installer" section below and proceed to "After the installation" below
    #*Download complete installer ('''if you do <u>NOT</u> have Adobe Reader installed'''):
    #**Use the links below to avoid getting the troublesome "getplus" Adobe Download Manager and other "extras" you may not want
    #**Use Firefox to download and SAVE the installer to your hard drive from the appropriate link below
    #**Click "Save to File"; save to your Desktop (so you can find it)
    #**After download completes, close Firefox
    #**Click the installer you just downloaded and allow the install to continue
    #***Note: Vista and Win7 users may need to right-click the installer and choose "Run as Administrator"
    #**'''<u>Download link</u>''': ftp://ftp.adobe.com/pub/adobe/reader/
    #***Choose your OS
    #***Choose the latest #.x version (example 9.x, for version 9)
    #***Choose the highest number version listed
    #****NOTE: 10.x is the new Adobe Reader X (Windows and Mac only as of this posting)
    #***Choose your language
    #***Download the file, SAVE it to your hard drive, when complete, close Firefox, click on the installer you just downloaded and let it install.
    #***Windows: choose the .exe file; Mac: choose the .dmg file
    #*Using either of the links below will force you to install the "getPlus" Adobe Download Manager. Also be sure to uncheck the McAfee Scanner if you do not want the link forcibly installed on your desktop
    #**''<u>Also see Download link</u>''': http://get.adobe.com/reader/otherversions/
    #**Also see: https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox (do not use the link on this page for downloading; you may get the troublesome "getplus" Adobe Download Manager (Adobe DLM) and other "extras")
    #*After the installation, start Firefox and check your version again.

  • Problem with GRID NAVIGATION EFFECTS WITH JQUERY

    Hi All,
    Im having problem with this image gallery with navigation (please see link below to see running demo). I am trying to use the 'Row move' style but am having problems getting the function to work. I have the images and everything set up fine but the actual function/navigation isn't working. I have downloaded all the relevant files to my computer but nothing happens when i click on the arrows. Also all of the 20 images are showing instead of just the 2 rows of 3? There should be 2 rows of 3 iamages showing then when the arrows are clicked the next two rows are shown and so on.
    http://tympanus.net/codrops/2011/06/09/grid-navigation-effects/
    This is the code i have -
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>My gallery</title>
    <link href="stylesheet.css" rel="stylesheet" type="text/css" />
    <link href="gridNavigation.css" rel="stylesheet" type="text/css" />
    <link href="reset.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    body {
              background-color: #000000;
    a:link {
              text-decoration: none;
              color:#f1d379;
    a:visited {
              text-decoration: none;
              color: #f1d379;
    a:hover {
              text-decoration: none;
              color: #9d6f1b;
    a:active {
              text-decoration: none;
              color: #f1d379;
    </style>
            <script type="text/javascript" src="scripts/jquery-1.6.1.min.js"></script>
                        <script type="text/javascript" src="scripts/jquery.easing.1.3.js"></script>
                        <script type="text/javascript" src="scripts/jquery.mousewheel.js"></script>
                        <script type="text/javascript" src="scripts/jquery.gridnav.js"></script>
    <script type="text/javascript">
                                  $(function() {
                                            $('#tj_container').gridnav({
                                                      type          : {
                                                          rows    : 2,
                                                                mode                    : 'rows',                               // use def | fade | seqfade | updown | sequpdown | showhide | disperse | rows
                                                                speed                    : 1000,                                        // for fade, seqfade, updown, sequpdown, showhide, disperse, rows
                                                                easing                    : 'easeInOutBack',          // for fade, seqfade, updown, sequpdown, showhide, disperse, rows
                                                                factor                    : 150,                                        // for seqfade, sequpdown, rows
                                                                reverse                    : ''                                        // for sequpdown
                        </script>
    </head>
    <body>
    <div class="container" id="container">
    <div id="navbar" class="#navbar">
    <ul>
              <li><a  href="index.html">Homepage</a></li>
              <li><a  href="about_me.html" >About me</a></li>
              <li><a  href="gallery.html">Gallery</a></li>
              <li><a  href="contact.html">Contact</a></li>
      </ul>
    </div>
                                                      <div class="tj_nav">
                                                                <span id="tj_prev" class="tj_prev">Previous</span>
                                                                <span id="tj_next" class="tj_next">Next</span>
                                                      </div>
                                                      <div class="tj_wrapper">
                                                                <ul class="tj_gallery">
                                                                          <li><a href="#"><img src="images/1.jpg" alt="image01" /></a></li>
                                                                          <li><a href="#"><img src="images/2.jpg" alt="image02" /></a></li>
                                                                          <li><a href="#"><img src="images/3.jpg" alt="image03" /></a></li>
                                                                          <li><a href="#"><img src="images/4.jpg" alt="image04" /></a></li>
                                                                          <li><a href="#"><img src="images/5.jpg" alt="image05" /></a></li>
                                                                          <li><a href="#"><img src="images/6.jpg" alt="image06" /></a></li>
                                                                          <li><a href="#"><img src="images/7.jpg" alt="image07" /></a></li>
                                                                          <li><a href="#"><img src="images/8.jpg" alt="image08" /></a></li>
                                                                          <li><a href="#"><img src="images/9.jpg" alt="image09" /></a></li>
                                                                          <li><a href="#"><img src="images/10.jpg" alt="image10" /></a></li>
                                                                          <li><a href="#"><img src="images/11.jpg" alt="image11" /></a></li>
                                                                          <li><a href="#"><img src="images/12.jpg" alt="image12" /></a></li>
                                                                          <li><a href="#"><img src="images/13.jpg" alt="image13" /></a></li>
                                                                          <li><a href="#"><img src="images/14.jpg" alt="image14" /></a></li>
                                                                          <li><a href="#"><img src="images/15.jpg" alt="image15" /></a></li>
                                                                          <li><a href="#"><img src="images/16.jpg" alt="image16" /></a></li>
                                                                          <li><a href="#"><img src="images/17.jpg" alt="image17" /></a></li>
                                                                          <li><a href="#"><img src="images/18.jpg" alt="image18" /></a></li>
                                                                          <li><a href="#"><img src="images/19.jpg" alt="image19" /></a></li>
                                                                          <li><a href="#"><img src="images/20.jpg" alt="image20" /></a></li>
                                                        </ul>
                </div>
    </div>
    </body>
    </html>

    Not sure what example you are using but it looks like you have missed out a couple of important <divs> in your code which surround the main <div>:
    If the case of example five:
    <div class="content example5'>
    <div id="tj_container" class="tj_container">
    MAIN STUFF GOES HERE
    </div>
    </div>
    I dont know if its my computer or not but I found the animation a bit flaky.

  • Problems with Grid View Selections

    I'm having problems with multiple selections in the grid view.  I can select multiple files, but as soon as I click on one of the selected files, it deslects all the other files and only highlights the one I clicked on.  I'm also unable to drag any file or files to a Collection or Publish Services.  This has just recently cropped up. I'm using LR 3.2 and have even reinstalled the software from 3.0 but I'm still having the same issue. Any ideas?

    Wow. I feel silly that it could have been such a simple thing.  Seems to have taken care of the problem.  I must not have been paying attention to where I was clicking.  Thanks!

  • I installed ios7 last week. The Safari screen is blank, and nothing works in the Search bar. Problems with facetime the previous day, but that is solved. What's up with Safari?

    I installed ios7 on the iPad last week. Problems with factime, but solved with online support. Now the Safari screen is blank, and nothing works in the Search bar. What's up with that? All other Internet uses are working.

    Hi, a too full hard drive can really mess things up.
    Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, , try to clear at least 10 GB of space & empty the trash, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)

  • No toolbars. I tried 'safe mode' but still no tool bar to navigate with also reinstalled

    No tool bars/address bar/only "Firefox-Mozilla Firefox" upper left corner and Firefox tabs. That's it. Went to your chat they directed me to reinstall-I did-same thing-tried 'safe mode' no help there either.
    == This happened ==
    Every time Firefox opened
    == after installed, worked OK for a while back in January

    Hit the '''Alt''' key to show the Menu bar, then open View > Toolbars and select Menu bar, so it has a check-mark.

  • When I right click on the tool bar (on icons with the little arrow down and to the right) to get the additional options, nothing happens.

    I've been trying to get the circle too, or any other tool options and just can't. Right clicking anywhere on the tool bar does nothing. Neither does double clicking the down/right arrow. Did I screw up my preferences or disable something? I'd love a little help here. I'd ask adobe directly but the chat somehow got disabled, and I don't have time to call.

    Click and hold. Not right click.

Maybe you are looking for

  • Number of records in Cube and in report

    Hi, Is it possible to have less number of records visible in InfoCube and in reporting report has to show all the records?i.e., if cube contains 100000 records while using InfoCube--->manage and checking the data it has to show only 90000 records,whi

  • SEM-CPM Balanced Scorecard and Management Cockpit

    Hi Does anyone have any examples(screenshots) of the Management Cockpit and Balanced Scorecard BSP applications? Thanks Yeteen

  • Broadcasting: To automate the process of E-mailing reports to users

    Hi, Can you share in details the approach to automatically e-mail query outputs at specific times to specific users? Is the right term “broadcast” in this case? Thanks

  • Housing is broken by headphone jack input

    Hi there! I bought a 16gb iPod Nano (7th Gen) less than a year ago. This is the third iPod that I've owned and have never had an issue. Until this one. The housing by the headphone jack input has broken. Can anyone here give me insight on what I need

  • Flash Buttom accessing page in Dreamweaver

    I am using a symbol button to navigate from a menu bar developed in flash and this will be used on dreamweaver. How do I set up the actions to do that? menu in flash going to index. htm Dreamweaver thank you Bob