Grow and Shrink the gallery's "mainImage"

Grow and Shrink the gallery's "mainImage"
I may pursue another option with the
Class on trigger
In this sample, a CSS class is set on the trigger to alert the user that something happens on the element. This is set as an option in the constructor.
<script type="text/javascript">
var highlight_tooltip = new Spry.Widget.Tooltip('highlighttrigger', '#classonme', {hideDelay:500, hoverClass:"enlarge"})
</script>
We have the main image in the photo gallery at full size.
This is the image placeholder called "main image".
Currently it is looks like this:
<img id="mainImage" alt="main image" src=""/>
I assume we add a mark-up similar to the icon grow effects code.
So I will take a stab it now;
<div id="Photograph" spry:region="dsPhotograph" onclick="HandlePhotograhClick('{ds_RowID}');" onmouseover="GrowPhotograph(this.getElementsByTagName('img')[0], '{@thumbwidth}', '{@Photographheight}');" onmouseout="ShrinkPhotograph(this.getElementsByTagName('img')[0]);"> <img src="galleries/{dsGalleries::@base}{dsGallery::Photograph/@base}{@Photographpath}" alt="Photograph for {@Photographpath}" width="Not Sure" height="Not Sure" id="tn{ds_RowID}" style="left: 0px; right: 0px;" onmouseover="this.style.cursor='pointer'" /> </div>
      <p class="ClearAll"></p>
//need to look at ClearAll
    </div>
//Now Add stuff the gallery.js
// Show the image of the current selected row inside the dsPhotos data set.
function ShowCurrentImage()
     var curRow = dsPhotos.getCurrentRow();
     SetMainImage("galleries/" + dsGalleries.getCurrentRow()["@base"] + "images/" + curRow["@path"], curRow["@width"], curRow["@height"], "tn" + curRow["ds_RowID"]);
//I Need a variable like;
["@bigPhoto"]
//Now I need add a function
function HandlePhotographClick(id)
     //StopSlideShow();
     //dsPhotos.setCurrentRow(id);
     //ShowCurrentImage();
        //call Photograph grow ???
// Trigger the animation of the Photograh growing to it's next largest size.
function GrowPhotograph(img, width, height)
     Spry.Utils.addClassName(img, "inFocus");
     img.style.zIndex = 150;
     var id = img.getAttribute("id");
        //ADD This to the function GrowThumbnail in Gallery.js
//after//
     //var twidth = Math.floor(width * .75);
     //var theight = Math.floor(height * .75);
     //var tx = (gThumbWidth - twidth) / 2;
     //var ty = (gThumbHeight - theight) / 2;
     var pwidth = Math.floor(width * 1.75);
     var pheight = Math.floor(height * 1.75);
     var px = (pThumbWidth - pwidth) / 2;//need to check this may not need
     var py = (pThumbHeight - pheight) / 2;//need to check this
     SizeAndPosition(id, tx, ty, twidth, theight, function(b){gBehaviorsArray[id] = null;});
// Trigger the animation of the Photograph shrinking.
function ShrinkPhotograph(img)
     Spry.Utils.addClassName(img, "inFocus");
     img.style.zIndex = 1;
     var id = img.getAttribute("id");
//Need to look at this stuff below, any input from anybody would be good....
     SizeAndPosition(id, 0, 0, gThumbWidth, gThumbHeight, function(b){gBehaviorsArray[id] = null; Spry.Utils.removeClassName(img, "inFocus");});
// Show the image of the current selected row inside the dsPhotos data set.
function ShowCurrentImage()
     var curRow = dsPhotos.getCurrentRow();
     SetMainImage("galleries/" + dsGalleries.getCurrentRow()["@base"] + "images/" + curRow["@path"], curRow["@width"], curRow["@height"], "tn" + curRow["ds_RowID"]);
Message was edited by: W_Bell

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class GrowRight
public static void main (String args[]) throws InterruptedException
JLabel label = new JLabel ("this is a test...");
final JFrame frame = new JFrame ("GrowRight");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout (new FlowLayout());
frame.getContentPane().add (label);
frame.setSize (label.getPreferredSize());
frame.pack();
final Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation (d.width - frame.getSize().width, 0);
frame.setVisible (true);
frame.addComponentListener(new ComponentAdapter(){//<---------------------
  public void componentResized(ComponentEvent ce){
    frame.setLocation (d.width - frame.getSize().width, 0);
Thread.sleep (5000);
label.setText ("for the next sixty seconds, this station...");
frame.setSize (label.getPreferredSize());
frame.pack();
}

Similar Messages

  • Grow and shrink JLabel to the left?

    I'm interested in putting a JLabel on the right hand side of the screen and having it resize (grow and shrink) on an on-going basis to the left. Any pointers on this? Here's some code that places a label on the upper right of the screen and then resizes the label. It grows off the right hand side of the screen...
    import javax.swing.*;
    import java.awt.*;
    public class GrowRight
    public static void main (String args[]) throws InterruptedException
    JLabel label = new JLabel ("this is a test...");
    JFrame frame = new JFrame ("GrowRight");
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout (new FlowLayout());
    frame.getContentPane().add (label);
    frame.setSize (label.getPreferredSize());
    frame.pack();
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation (d.width - frame.getSize().width, 0);
    frame.setVisible (true);
    Thread.sleep (50000);
    label.setText ("for the next sixty seconds, this station...");
    frame.setSize (label.getPreferredSize());
    frame.pack();
    Any help would be appreciated! Thanks.

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class GrowRight
    public static void main (String args[]) throws InterruptedException
    JLabel label = new JLabel ("this is a test...");
    final JFrame frame = new JFrame ("GrowRight");
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout (new FlowLayout());
    frame.getContentPane().add (label);
    frame.setSize (label.getPreferredSize());
    frame.pack();
    final Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation (d.width - frame.getSize().width, 0);
    frame.setVisible (true);
    frame.addComponentListener(new ComponentAdapter(){//<---------------------
      public void componentResized(ComponentEvent ce){
        frame.setLocation (d.width - frame.getSize().width, 0);
    Thread.sleep (5000);
    label.setText ("for the next sixty seconds, this station...");
    frame.setSize (label.getPreferredSize());
    frame.pack();
    }

  • Growing and shrinking text

    hi,
    does anyone know how to make text grow and shrink? i'm using oprea web browser, and when i place my mouse over some buttons text appears and then moving it off the button the text shrink, it does not appear and disappear, but actually grows out and shrinks in from a point. does anyone know how to do this?
    Thank you.

    hi,
    thank you for the response, i know about the listener, question was really regarding how to resize text so that it resizes smoothly, looks like it's growing and shrinking not just one second it's size 10 and then size 1, i want to make it flow from 10 to 1 for example, like opera browser, should i use a thread or is there a better way?
    Thank you.

  • ArrayList will grow and shrink implicitly

    Hi,
    I have an ArrayList which is going to hold 1000 elements, hence I have defined the List as :-
    List list = new ArrayList(1000);
    If the number of elements is less than 1000 , in such case whether the ArrayList will shrink implictly and similarly
    if the number of elements grows from 1000 to 1500 whether the ArrayList will increase the size implicitly to 1500?
    I know that ArrayList will increase the size of its internal array to 50 % when compared to Vector?
    If the above wont happen then it will be a problem as unnecessary memory space will be available List?
    Please clarify.
    Thanks.

    797836 wrote:
    Thanks.
    This clearly indicates that if we are entirely sure that you are going to work with 1000 elements then better to define the initial capacity that way ,It can be better. In many cases--probably most cases--it will make no noticeable difference.
    if not, use always use the default value (ie) 10. That can be better. In many cases, it will make no noticeable difference. Also note that resizing costs time and memory. For a brief period, there are two copies of the backing array--the initial one and the new, larger one. And of course copying the references takes CPU cycles. Most of the time this will not be noticeable, but if you're comparing specifying the initial size vs. going with the default, it's worth considering.
    Also note that there exists a method to shrink the array. I think it's called trimToSize() or something like that.
    In the end, if you think you have a rough idea how big the list will get, you may get some benefit from creating it with an appropriate initial capacity. Most of the time, however, it won't make a noticeable difference either way, so it's not usually worth spending much time thinking about it. When you test for scalability, if you find a bottleneck there, you can adjust the initial capacity as needed.

  • Unable to grow and shrink a JTable within a JScrollPane

    I need help with the following: I want to display a JTable component with a calendar like design. Dragging the size of the parent component (having a border to drag) should dynamically adapt the JTable' size and its cells. Since the JTable has a minimum size shrinking the parent component should show scrollbars if the minimum size is reached horizontal or vertical respectively.
    I have the JTable put ijnto the viewport of a scrollpane and the scrollpane is the child component of a JPanel. So dragging appears with the panel.
    The JTable cells do nicely but from a specific size on there is a grey area on the lower part of the JPanel which is not repainted. What is causing this? What do I have to do? I'm lost in the jungle of invalidate(), repaint(), update(), doLayout() etc.
    Here is my SSCCE (at least I hope it is one):
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.event.ComponentAdapter;
    import java.awt.event.ComponentEvent;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.ListSelectionModel;
    import javax.swing.UIManager;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableModel;
    //public class MyComponent extends JScrollPane
    public class MyComponent extends JPanel
    ///   class data
         static public final long serialVersionUID = -1L;
         static public final int c_ColWidth = 29;
         static public final int c_RowHeight = 18;
         static public final int c_TableWidth = 930;
         static public final int c_TableHeight = 234;
    ///   instance data
         private String[] m_strColHeader = {
              "01", "02", "03", "04", "05", "06", "07", "08", "09", "10",
              "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
              "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
              "31",
         private Object[][] m_Data = new Object[12][33];// data array
         private TableModel m_DataModel = new AbstractTableModel() {
              static public final long serialVersionUID = -1L;
              public int getColumnCount() { return m_strColHeader.length; }
              public int getRowCount() { return m_Data != null ? m_Data.length : 0; }
              public Object getValueAt(int row, int col) { return m_Data[row][col]; }
              public String getColumnName(int col) { return m_strColHeader[col]; }
              public Class getColumnClass(int col) { return String.class; }
              public boolean isCellEditable(int row, int col) { return false; }
              public void setValueAt(Object aValue, int row, int col) {
                   m_Data[row][col] = aValue;
         protected BorderLayout myLayout = new BorderLayout();
         protected JTable tableView = new JTable(m_DataModel);
         protected JScrollPane scrollPane = new JScrollPane(tableView);
    ///   public class methods
         static public void main(String[] args)
              try
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch(Exception e)
                   e.printStackTrace();
              MyComponent comp1 = new MyComponent();
              JFrame frame = new JFrame("MyComponent");
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              frame.getContentPane().add(comp1);
              frame.pack();
              frame.setVisible(true);
    ///   constructors
         public MyComponent()
              try
                   jbInit();
                   initTable();
              catch(Exception ex)
                   ex.printStackTrace();
    ///   protected instance methods
         protected void initTable()
              // do nor allow user interaction with calendar view
              tableView.getTableHeader().setReorderingAllowed(false);
              tableView.getTableHeader().setResizingAllowed(false);
              //tableView.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
              tableView.setRowHeight(c_RowHeight);
              // adapt all CellRenderers
              for (int i = 0; i < m_DataModel.getColumnCount(); i++)
                   TableColumn column = tableView.getColumn(tableView.getColumnName(i));
                   column.setMinWidth(c_ColWidth);
                   column.setPreferredWidth(c_ColWidth);
    ///   private instance methods
         private void jbInit() throws Exception
              this.setLayout(myLayout);
              this.add(scrollPane, BorderLayout.CENTER);
              scrollPane.getViewport().setMinimumSize(new Dimension(c_TableWidth, c_TableHeight));
              scrollPane.getViewport().setPreferredSize(new Dimension(c_TableWidth, c_TableHeight));
              tableView.setPreferredSize(new Dimension(c_TableWidth, c_TableHeight));
              addComponentListener(new MyComponent_componentAdapter(this));
    ///   event handling
         public void componentBoundsChanged(ComponentEvent e)
              scrollPane.setBounds(0, 0, getWidth(), getHeight());
              scrollPane.getViewport().setBounds(0, 0, getWidth(), getHeight());
              //tableView.setBounds(0, 0, getWidth(), getHeight());
              tableView.setSize(scrollPane.getViewport().getWidth(), scrollPane.getViewport().getHeight());
              tableView.setRowHeight(getBounds().height / 13 < c_RowHeight ?
                        c_RowHeight : getBounds().height / 13);
              System.out.println("componentBoundsChanged: getBounds() = " + getBounds());
              System.out.println("componentBoundsChanged: getSize() = " + getSize());
              System.out.println("componentBoundsChanged: getViewport().getBounds() = " + scrollPane.getViewport().getBounds());
              System.out.println("componentBoundsChanged: getViewport().getSize() = " + scrollPane.getViewport().getSize());
              System.out.println("componentBoundsChanged: tableView.getBounds() = " + tableView.getBounds());
              System.out.println("componentBoundsChanged: tableView.getSize() = " + tableView.getSize());
    ///   event adapters
    class MyComponent_componentAdapter extends ComponentAdapter
         protected MyComponent adaptee;
         MyComponent_componentAdapter(MyComponent adaptee)
              this.adaptee = adaptee;
         public void componentMoved(ComponentEvent e)
              adaptee.componentBoundsChanged(e);
         public void componentResized(ComponentEvent e)
              adaptee.componentBoundsChanged(e);
    }

    I guess i am facing exactly opposite problem.
    What i want to do is, I have nested tables in a scroll pane. So I don't want a scroll pane to show exactly whatever visible rows are there in Table (No extra space). If i expand any row, i want scroll pane to be able to show expanded.

  • HashMap will grow and shrink dynamically

    Hi,
    By default Hashmap takes 16 as an initial capacity. If it is more than 16 it will grow dynamically based on the constant factor.
    If it is less than 16 elements set whether it will shrink dynamically as well? Please clarify.
    Thanks.

    797836 wrote:
    Hi,
    By default Hashmap takes 16 as an initial capacity. If it is more than 16 it will grow dynamically based on the constant factor.
    If it is less than 16 elements set whether it will shrink dynamically as well? Please clarify.
    Thanks.The size() call will give you a reduced number of entries. Entries are stored internally in an array, that will grow, but never shrink. I.e. if you add 25 entries to a new HashMap it will have a capacity of 32 and a size of 25. After removing 10 of those entries capacity will still be 32, but size will be 15.

  • Dynamically grow and wrap the column within the page

    Hi All,
    I have the situation where my xml includes a lot of cells (columns) but only about 5 cells (columns) can fit in a page with 8 1/2 in. Can i set up a form to dynamically wrap the table when it hit the maximum of width? Anyone have any idea about this. In the designer i only see the option to set row grow but not cell (column). Is this possible to dynamically grow the column.
    Thanks
    --Khiem

    Your only option would be to increase the width of a page. You could use a landscape page or simply make the width of the page as big as necessary.
    Paul

  • Shrink Log file in log shipping and change the database state from Standby to No recovery mode

    Hello all,
    I have configured sql server 2008 R2 log shipping for some databases and I have two issues:
    can I shrink the log file for these databases: If I change the primary database from full to simple and shrink the log file then change it back to full recovery mode the log shipping will fail, I've seen some answers talked about using "No
    Truncate" option, but as I know this option will not affect the log file and it will shrink the data file only.
          I also can't create maintenance to reconfigure the log shipping every time I want to shrink the log file because the database size is huge and it will take time to restore in the DR site, so the reconfiguration
    is not an option :( 
    how can I change the secondary database state from Standby to No recovery mode? I tried to change it from the wizard and wait until the next restore for the transaction log backup, but the job failed and the error was: "the step failed". I need
    to do this to change the mdf and ldf file location for the secondary databases.
    can any one help?
    Thanks in advance,
    Faris ALMasri
    Database Administrator

    1. can I shrink the log file for these databases: If I change the primary database from full to simple and shrink the log file then change it back to full recovery mode the log shipping will fail, I've seen some answers talked about using "No Truncate"
    option, but as I know this option will not affect the log file and it will shrink the data file only.
          I also can't create maintenance to reconfigure the log shipping every time I want to shrink the log file because the database size is huge
    and it will take time to restore in the DR site, so the reconfiguration is not an option :( 
    2. how can I change the secondary database state from Standby to No recovery mode? I tried to change it from the wizard and wait until the next restore for the transaction log backup, but the job failed and the error was: "the step failed". I need to do
    this to change the mdf and ldf file location for the secondary databases.
    can any one help?
    Thanks in advance,
    Faris ALMasri
    Database Administrator
    1. If you change recovery model of database in logshipping to simple and back to full Logshipping will break and logs wont be resored on Secondary server as log chain will be broken.You can shrink log file of primary database but why would you need that
    what is schedule of log backup. Frequent log backup is already taking care of log files why to shrink it and create performance load on system when log file will ultimately grow and since because instant file initilaization is not for Log files it takes time
    to grow and thus slows performace.
    You said you want to shrink as Database size is huge is it huge or does it have lots of free space. dont worry about data file free space it will eventually be utilized by SQL server when more data comes
    2. You are following wrong method changing state to no recovery would not even allow you to run select queries which you can run in Standby mode. Please refer below link to move Secondary data and log files
    http://www.mssqltips.com/sqlservertip/2836/steps-to-move-sql-server-log-shipping-secondary-database-files/
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • How do I shrink the display away from monitor edges

    When this new version of firefox comes on, it fills the entire monitor to its edges. In my previous versions I could click on the square symbol in the upper right corner and shrink the firefox display field so I could drag it around to see my window icons. But now I cannot do this. Why not?
    Thanks, Wiley

    Hi there
    It's a feature!
    Aside from making Ctrl+E your new best friend, the best you can do is report to Adobe and hope it gets fixed in a future release.
    Click here to file a bug report
    Cheers... Rick

  • Expand and Shrink

    hey guys I am writing a program using gui's that is supposed to expand and shrink the JFrame that it is in.
    Here is my code why doesn't this work?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class expandAndShrink extends JFrame implements ActionListener
      JButton expandButton ;
      JButton shrinkButton ;
      // constructor for TwoButtons
      public expandAndShrink()                          
        expandButton = new JButton("Expand");
        shrinkButton = new JButton("Shrink");
        expandButton.setActionCommand( "expand" );   // set the  command
        shrinkButton.setActionCommand( "shrink" ); // set the  command  
        getContentPane().setLayout( new FlowLayout() );
        getContentPane().add( expandButton );                     
        getContentPane().add( shrinkButton );
        expandButton.addActionListener( this );
        shrinkButton.addActionListener( this );    
      public void actionPerformed( ActionEvent evt)
        // check which command has been sent
        if ( evt.getActionCommand().equals( "expand" ) ){
          expandAndShrink.setSize(220,170 );   
        else {
         expandAndShrink.setSize(180,130);   
      public static void main ( String[] args )
        expandAndShrink demo  = new expandAndShrink() ;
        WindowQuitter wquit = new WindowQuitter(); 
        demo.addWindowListener( wquit ); 
        demo.setSize( 200, 150 );    
        demo.setVisible( true );     
    class WindowQuitter extends WindowAdapter
      public void windowClosing( WindowEvent e )
        System.exit( 0 ); 
    }

    change this code
    public void actionPerformed( ActionEvent evt)
        // check which command has been sent
        if ( evt.getActionCommand().equals( "expand" ) ){
          expandAndShrink.setSize(220,170 );   
        else {
         expandAndShrink.setSize(180,130);   
      }to this
    public void actionPerformed( ActionEvent evt)
        // check which command has been sent
        if ( evt.getActionCommand().equals( "expand" ) ){
          this.setSize(220,170 );   
        else {
         this.setSize(180,130);   
      }~Tim

  • Set location of components and reduce the size

    I want to resize JavaFX component and shrink the components which are next to it. Here is the result which I get:
    When I click on the angle of this component I can resize it down and right.
    http://i.stack.imgur.com/jqoNW.png
    The components which are next to it are pushed down and right. Part of them are behind the visible part of the screen.
    http://i.stack.imgur.com/rsi0L.png
    All components are placed in BorderPane,VBox,HBoxand againBorderPane. I don't want to allow components to move. I want to shrink them and use Scrollpane` when their size is reduced. Can you give me some hits how to solve these two problems?
    Ref javafx 2 - Set location of components and reduce the size - Stack Overflow

    I did something similar the other day. Based on the resizing of the scene I adjusted the position.
    widthProperty().addListener(new ChangeListener<Number>() {
        @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) {
            widthChange((Double)oldSceneWidth, (Double)newSceneWidth);
    heightProperty().addListener(new ChangeListener<Number>() {
        @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneHeight, Number newSceneHeight) {
            heightChange((Double)oldSceneHeight, (Double)newSceneHeight);
    You should be able to do something similar, when you add a change listener to your component and handle the resizing of the other components.
    What I don't understand is why you would need a scrollbar, when the components shrink down. I would think it would be the other way round.

  • Are there hotkeys to maximize and shrink (not minimize) window/tab

    Don't know whether this is a Safari question or a Mac OS question, but when I fire up Safari, the program opens up with roughly a 1/2 screen window. I've been mousing up to the upper r-h corner to maximize and shrink the window. Can't seem to find a hotkey combination that does the same thing. Is there one?
    According to iTunes update, I'm using OS X 10.8.4  Don't know if that is 'Mountion Lion' or not. ??
    As an aside, I'm a recovering PC user. Bought my first Mac (MacBook Air) a week ago, basically upon Rush's raving about them and the ease of use people tell me about them. I'm happily discovering all of what I've heard is true.

    Aahhh, so THAT'S what the caret sign represents. The control key. I was playing twister on the kbd with shift-6, command f.  Works better using the right keys. Thanks a bunch.

  • When i connect my iphone to the pc it automatically opens the gallery as a usb even if phone is locked.how can i protect this?

    when i connect my iphone to the pc it automatically opens the gallery as a usb even if phone is locked.how can i protect this?
    i want my phone to be protected so that not anyone can simply fix my phone to a pc and see the gallery. thank you

    You can not prevent it using any setting on the phone, just as you can not do so with any digital camera.

  • Expand and Shrink window

    Hey I am writing a program that expands and shrinks the JFrame that it is in but all the program does is expand the window here is my code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class expandAndShrink extends JFrame implements ActionListener
      JButton expandButton ;
      JButton shrinkButton ;
      int x,y;
      int x2,y2;
      // constructor for TwoButtons
      public expandAndShrink()                          
        expandButton = new JButton("Expand");
        shrinkButton = new JButton("Shrink");
        expandButton.setActionCommand( "expand" );   // set the  command
        shrinkButton.setActionCommand( "shrink" ); // set the  command  
        getContentPane().setLayout( new FlowLayout() );
        getContentPane().add( expandButton );                     
        getContentPane().add( shrinkButton );
        expandButton.addActionListener( this );
        shrinkButton.addActionListener( this );    
      public void actionPerformed( ActionEvent evt)
        // check which command has been sent
        x=200+x;
        y=150+y;
        if ( evt.getActionCommand().equals( "expand" ) ){
        x2 = (int)(x * 0.1); // This cast is the same as a Floor function
         y2 = (int)(y * 0.1);
         x=x+x2;
        y=y+y2;
        this.setSize(x,y);
        else{
        x2 = (int)(x * 0.1); // This cast is the same as a Floor function
         y2 = (int)(y * 0.1);
         x=x-x2;
        y=y-y2;
        this.setSize(x,y);
      public static void main ( String[] args )
        expandAndShrink demo  = new expandAndShrink() ;
        WindowQuitter wquit = new WindowQuitter(); 
        demo.addWindowListener( wquit ); 
        demo.setSize( 200, 150 );    
        demo.setVisible( true );     
    class WindowQuitter extends WindowAdapter
      public void windowClosing( WindowEvent e )
        System.exit( 0 ); 
    }

    x=200+x;
    y=150+y;The first thing you do is increase the values of x and y. Then you expand and shrink from there. Doesn't look right to me.

  • Images should grow or shrink when the user chooses a larger or smaller font size in ADE.

    Hi All,
    I use percentage values (in "width" attribute within "img" element) for image that should grow or shrink when the user
    chooses a larger or smaller font size. The adjustment affects not only the size of the text but also images but the images
    are getting distorted or blurred when user chooses larger font size in Adobe Digital Editions.
    Can anyone, please guide me; how to get non-distorted and non-blur images in epub package?
    If I directly use images, without svg format i.e. png or jpg files, then images get overlapped on body-text in two column display in ADE.
    OR
    if I directly use jpg or png with width attribute varying in percentage value then image shrinks and grows as user chooses smaller and larger font size but the problem of distorted image remains as it is
    <div class="media-group"><img src="images/pa0000016g26001.png or jpg" alt="Image" width="60 or 70%" /></div>
    Attached is the package (Book.epub) which has test cases.
    ========================================================
    Please find below sample coding used in attached epub package;
    In XHTML:
    <div class="media-group"><img src="images/pa0000016g26001.svg" alt="Image" width="100%" /></div>
    In SVG:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
    <!ENTITY ns_svg "http://www.w3.org/2000/svg">
    <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
    ]>
    <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="386px" height="554px" viewBox="0 0 386 554" enable-background="new 0 0 386 554" xml:space="preserve">
    <image overflow="visible" width="772" height="1108" xlink:href="pa0000016g26001.png"  transform="matrix(0.50 0 0 0.50 0 0)">
    </image>
    </svg>
    ========================================================
    Cheers
    Vikas

    Hi DenisonDoc,
    There is no option right now to set properties globally primarily for Text fields. You may make sure fields doesn't contain anything.
    Select all the text filed from the form and right click any of the selected field make sure all of them are selected choose properties --> Appearance there you can choose Font Size and Font type.
    - End users cant change size and type of font. It is up to designer.
    Regards,
    Ajlan Huda.

Maybe you are looking for