From 41a26623990e30a9496f96e2c30031cdc83cd40c Mon Sep 17 00:00:00 2001 From: rubaiz Date: Thu, 6 Dec 2007 15:23:39 +0000 Subject: [PATCH] image scaling works, buggy when using full images so using thumbnails for now modified the UI to be make space for the new slider and make the sliders more intuitive(i think) --- src/image/FlickrImageFetcher.java | 1 + src/powerreader/ConfigurationManager.java | 10 ++ src/powerreader/Pick.java | 77 ++++++--- src/powerreader/Player.java | 23 ++- src/powerreader/PowerReaderUI.form | 196 ++++++++++++++++------ src/powerreader/PowerReaderUI.java | 187 ++++++++++++++------- 6 files changed, 352 insertions(+), 142 deletions(-) diff --git a/src/image/FlickrImageFetcher.java b/src/image/FlickrImageFetcher.java index e8d9ea7..33d21c0 100644 --- a/src/image/FlickrImageFetcher.java +++ b/src/image/FlickrImageFetcher.java @@ -47,6 +47,7 @@ public String getImageURL(String text) { PhotoList pl = pi.search(sp, 1, 1); if (!pl.isEmpty()) { return ((Photo) pl.get(0)).getThumbnailUrl(); + //return ((Photo) pl.get(0)).getUrl(); } } catch (Exception e) { System.out.println(e); diff --git a/src/powerreader/ConfigurationManager.java b/src/powerreader/ConfigurationManager.java index 96c47c7..8029744 100644 --- a/src/powerreader/ConfigurationManager.java +++ b/src/powerreader/ConfigurationManager.java @@ -69,12 +69,14 @@ public class ConfigurationManager { // Word focus level by default static private int m_focusLevel = 3; static private int m_detailLevel = 0; + static private int m_imageScale=3; private TransformGroup m_mainTransformGroup = null; private String fileName = null; private JSlider m_zoomSlider = null; + static { m_instance = new ConfigurationManager(); @@ -245,4 +247,12 @@ static public int getDetailLevel() { static public void setDetailLevel(int level) { m_detailLevel = level; } + + static public void setImageScale(int scale) { + m_imageScale = scale; + } + + static int getImageScale() { + return m_imageScale; + } } diff --git a/src/powerreader/Pick.java b/src/powerreader/Pick.java index 1d75eaf..7b4f4fc 100644 --- a/src/powerreader/Pick.java +++ b/src/powerreader/Pick.java @@ -11,7 +11,11 @@ //for image import com.sun.j3d.utils.image.TextureLoader; import image.ImageFetcher; +import java.awt.Image; +import java.awt.MediaTracker; import java.awt.event.MouseAdapter; +import java.awt.geom.AffineTransform; +import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.net.MalformedURLException; import java.net.URL; @@ -133,29 +137,7 @@ else if(ConfigurationManager.getFocusLevel() == RawTextParser.LEVEL_DOCUMENT_ID) Player.playOne(); // Get image - if(ConfigurationManager.showImages()) { - // clear out any existing images from the player - Player.removeImages(); - ImageFetcher f = ConfigurationManager.getImageFetcher(); - BufferedImage img = f.getImage(pickedText); - if (img != null) { - TextureLoader imageT = new TextureLoader(img,c3D); - Raster imageObj = new Raster(new Point3f(0, 0,1f), - Raster.RASTER_COLOR, 0, 0, imageT.getImage().getWidth(), imageT.getImage().getHeight(), - imageT.getImage(), null); - Shape3D shape = new Shape3D(imageObj); - imageObj.setCapability(Raster.ALLOW_IMAGE_WRITE); - BranchGroup node = new BranchGroup(); - - node.setCapability(BranchGroup.ALLOW_DETACH); - - node.addChild(shape); - lastPicked = tObj.getTheTextTransformGroup(); - lastPicked.addChild(node); - - lastAttached =node; - } - } + displayImage(pickedText, tObj); } // dictionary meaning if(mouseAction == ConfigurationManager.ACTION_DEFINE) { @@ -171,6 +153,55 @@ else if(ConfigurationManager.getFocusLevel() == RawTextParser.LEVEL_DOCUMENT_ID) ex.printStackTrace(); } } + + private void displayImage(final String pickedText, final TextObject3d tObj) { + + if(ConfigurationManager.showImages()) { + // clear out any existing images from the player + Player.removeImages(); + ImageFetcher f = ConfigurationManager.getImageFetcher(); + + BufferedImage bimg = f.getImage(pickedText); + + if (bimg != null) { + //scale image + //Image img = bimg.getScaledInstance(ConfigurationManager.getImageScale()*100,-1,Image.SCALE_DEFAULT); + + double scale = (ConfigurationManager.getImageScale()+1)*100/bimg.getWidth(); + AffineTransform tx = new AffineTransform(); + tx.scale(scale, scale); + BufferedImage img = bimg; // copying default image, in case scaling doesont work + try { + AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); + img = op.filter(bimg, null); + System.out.println("Scaled [w: " + bimg.getWidth() + " , h:"+ bimg.getHeight() +" ] to scale factor: " + ConfigurationManager.getImageScale()); + } catch(Exception e) { + System.out.println("Error scaling [w: " + bimg.getWidth() + " , h:"+ bimg.getHeight() +" ] to scale factor: " + ConfigurationManager.getImageScale()); + System.out.println(e); + } + + //render image + TextureLoader imageT = new TextureLoader(img); + Raster imageObj = new Raster(new Point3f(0, -0.1f ,1.0f), + Raster.RASTER_COLOR, 0, 0, imageT.getImage().getWidth(), imageT.getImage().getHeight(), + imageT.getImage(), null); + Shape3D shape = new Shape3D(imageObj); + imageObj.setCapability(Raster.ALLOW_IMAGE_WRITE); + BranchGroup node = new BranchGroup(); + + node.setCapability(BranchGroup.ALLOW_DETACH); + + node.addChild(shape); + + + lastPicked = tObj.getTheTextTransformGroup(); + lastPicked.addChild(node); + + //track the image so that it can be removed + lastAttached =node; + } + } + } public void mouseWheelMoved(MouseWheelEvent e) { ConfigurationManager.current_z += e.getWheelRotation()/-2.5f; diff --git a/src/powerreader/Player.java b/src/powerreader/Player.java index 2e950a2..0fe0138 100644 --- a/src/powerreader/Player.java +++ b/src/powerreader/Player.java @@ -9,6 +9,8 @@ package powerreader; +import java.awt.geom.AffineTransform; +import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Iterator; @@ -179,8 +181,25 @@ public void run() { Pick.removeImages(); ImageFetcher f = ConfigurationManager.getImageFetcher(); - BufferedImage img = f.getImage(currentObj.getValue()); - if (img != null) { + BufferedImage bimg = f.getImage(currentObj.getValue()); + if (bimg != null) { + //scale image + //Image img = bimg.getScaledInstance(ConfigurationManager.getImageScale()*100,-1,Image.SCALE_DEFAULT); + + double scale = (ConfigurationManager.getImageScale()+1)*100/bimg.getWidth(); + AffineTransform tx = new AffineTransform(); + tx.scale(scale, scale); + BufferedImage img = bimg; // copying default image, in case scaling doesont work + try { + AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); + img = op.filter(bimg, null); + System.out.println("Scaled [w: " + bimg.getWidth() + " , h:"+ bimg.getHeight() +" ] to scale factor: " + ConfigurationManager.getImageScale()); + } catch(Exception e) { + System.out.println("Error scaling [w: " + bimg.getWidth() + " , h:"+ bimg.getHeight() +" ] to scale factor: " + ConfigurationManager.getImageScale()); + System.out.println(e); + } + + //render image TextureLoader imageT = new TextureLoader(img); Raster imageObj = new Raster(new Point3f(0, -0.5f,1f), Raster.RASTER_COLOR, 0, 0, imageT.getImage().getWidth(), imageT.getImage().getHeight(), diff --git a/src/powerreader/PowerReaderUI.form b/src/powerreader/PowerReaderUI.form index 1ecb258..7fdfe2f 100644 --- a/src/powerreader/PowerReaderUI.form +++ b/src/powerreader/PowerReaderUI.form @@ -21,18 +21,19 @@ - - + - - - + + + + + @@ -46,45 +47,69 @@ - + - + + + + - + - - - - - - + + + - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -106,23 +131,53 @@ + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -134,7 +189,7 @@ - + @@ -142,7 +197,7 @@ - + @@ -150,12 +205,11 @@ - + - - + @@ -167,8 +221,8 @@ - - + + @@ -215,15 +269,16 @@ - - + + - + + @@ -235,8 +290,8 @@ - - + + @@ -409,8 +464,8 @@ - - + + @@ -425,6 +480,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/powerreader/PowerReaderUI.java b/src/powerreader/PowerReaderUI.java index 91d1182..a0a1412 100644 --- a/src/powerreader/PowerReaderUI.java +++ b/src/powerreader/PowerReaderUI.java @@ -127,6 +127,9 @@ private void initComponents() { m_checkBox_speechEnabled1 = new javax.swing.JCheckBox(); m_label_lof = new javax.swing.JLabel(); m_slider_lof = new javax.swing.JSlider(); + m_slider_imageSize = new javax.swing.JSlider(); + m_label_lod1 = new javax.swing.JLabel(); + m_label_readSpeed1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Power Reader Alpha"); @@ -135,19 +138,19 @@ private void initComponents() { m_panel_textArea.setLayout(m_panel_textAreaLayout); m_panel_textAreaLayout.setHorizontalGroup( m_panel_textAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 509, Short.MAX_VALUE) + .add(0, 520, Short.MAX_VALUE) ); m_panel_textAreaLayout.setVerticalGroup( m_panel_textAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 659, Short.MAX_VALUE) + .add(0, 713, Short.MAX_VALUE) ); - m_slider_readSpeed.setMajorTickSpacing(50); + m_panel_controlArea.setFocusCycleRoot(true); + m_slider_readSpeed.setMajorTickSpacing(58); m_slider_readSpeed.setMaximum(3000); m_slider_readSpeed.setMinimum(100); m_slider_readSpeed.setPaintTicks(true); - m_slider_readSpeed.setSnapToTicks(true); - m_slider_readSpeed.setValue(800); + m_slider_readSpeed.setValue(1550); m_slider_readSpeed.setName("Read Speed"); m_slider_readSpeed.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { @@ -156,8 +159,8 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { }); m_label_readSpeed.setFont(new java.awt.Font("Tahoma", 1, 11)); - m_label_readSpeed.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - m_label_readSpeed.setText("<--Faster Read Speed Slower-->"); + m_label_readSpeed.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + m_label_readSpeed.setText(" Read Speed"); m_button_play.setFont(new java.awt.Font("Tahoma", 1, 11)); m_button_play.setIcon(new javax.swing.ImageIcon(getClass().getResource("/powerreader/resources/player_play.png"))); @@ -188,12 +191,13 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { }); m_label_lod.setFont(new java.awt.Font("Tahoma", 1, 11)); - m_label_lod.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - m_label_lod.setText("<--Less Level of Detail More-->"); + m_label_lod.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + m_label_lod.setText("Level of Detail"); - m_slider_zoomLevel.setMajorTickSpacing(1); + m_slider_zoomLevel.setMajorTickSpacing(2); m_slider_zoomLevel.setMaximum(1); m_slider_zoomLevel.setMinimum(-100); + m_slider_zoomLevel.setPaintTicks(true); m_slider_zoomLevel.setValue(-25); m_slider_zoomLevel.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { @@ -202,8 +206,8 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { }); m_label_zoomLevel.setFont(new java.awt.Font("Tahoma", 1, 11)); - m_label_zoomLevel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - m_label_zoomLevel.setText("<--Low Zoom Level High-->"); + m_label_zoomLevel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + m_label_zoomLevel.setText("Zoom Level"); m_button_bgColor.setBackground(new java.awt.Color(255, 153, 0)); m_button_bgColor.setText("Background Color"); @@ -301,8 +305,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); m_label_lof.setFont(new java.awt.Font("Tahoma", 1, 11)); - m_label_lof.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - m_label_lof.setText("<--Less Level of Focus More-->"); + m_label_lof.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + m_label_lof.setText("Level of Focus"); m_slider_lof.setMajorTickSpacing(1); m_slider_lof.setMaximum(3); @@ -315,37 +319,71 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { } }); + m_slider_imageSize.setMajorTickSpacing(1); + m_slider_imageSize.setMaximum(5); + m_slider_imageSize.setMinimum(1); + m_slider_imageSize.setPaintTicks(true); + m_slider_imageSize.setSnapToTicks(true); + m_slider_imageSize.setValue(3); + m_slider_imageSize.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + m_slider_imageSizeStateChanged(evt); + } + }); + + m_label_lod1.setFont(new java.awt.Font("Tahoma", 1, 11)); + m_label_lod1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + m_label_lod1.setText(" Image Size (width)"); + + m_label_readSpeed1.setFont(new java.awt.Font("Tahoma", 1, 11)); + m_label_readSpeed1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + m_label_readSpeed1.setText("(-) <--- ---> (+)"); + org.jdesktop.layout.GroupLayout m_panel_controlAreaLayout = new org.jdesktop.layout.GroupLayout(m_panel_controlArea); m_panel_controlArea.setLayout(m_panel_controlAreaLayout); m_panel_controlAreaLayout.setHorizontalGroup( m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, m_panel_controlAreaLayout.createSequentialGroup() + .add(m_panel_controlAreaLayout.createSequentialGroup() .addContainerGap() - .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_label_lof, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(m_button_open, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_slider_zoomLevel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(m_label_readSpeed, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_panel_controlAreaLayout.createSequentialGroup() - .add(m_button_play, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE) + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_button_open, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .add(m_panel_controlAreaLayout.createSequentialGroup() + .add(m_button_play, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(m_buton_stop, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 129, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_slider_readSpeed, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(m_label_zoomLevel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 260, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_slider_lof, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(m_label_lod, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_slider_lod, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_button_bgColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_label_hlColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_button_hlColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(m_button_fgColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_label_bgColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_label_fgColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_checkBox_speechEnabled) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_checkBox_wordsGrow) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_checkBox_showImages) - .add(org.jdesktop.layout.GroupLayout.LEADING, m_checkBox_speechEnabled1)) + .add(m_panel_controlAreaLayout.createSequentialGroup() + .add(m_label_lof, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(m_slider_lof, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_panel_controlAreaLayout.createSequentialGroup() + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(m_label_lod1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_label_lod, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_slider_imageSize, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_slider_lod, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE))) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_panel_controlAreaLayout.createSequentialGroup() + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(m_label_zoomLevel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE) + .add(m_label_readSpeed, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_slider_readSpeed, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_slider_zoomLevel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE) + .add(m_label_readSpeed1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE))) + .add(m_button_bgColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .add(m_label_hlColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .add(m_button_hlColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_button_fgColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .add(m_label_bgColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .add(m_label_fgColor, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) + .add(m_checkBox_speechEnabled) + .add(m_checkBox_wordsGrow) + .add(m_checkBox_showImages) + .add(m_checkBox_speechEnabled1)) .addContainerGap()) ); m_panel_controlAreaLayout.setVerticalGroup( @@ -359,23 +397,41 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(m_buton_stop) .add(m_button_play)) + .add(10, 10, 10) + .add(m_label_readSpeed1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(m_label_readSpeed, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(m_slider_readSpeed, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(m_label_zoomLevel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(m_slider_zoomLevel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(m_label_lof, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(m_slider_lof, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(m_label_lod, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(m_slider_lod, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(m_panel_controlAreaLayout.createSequentialGroup() + .add(m_slider_readSpeed, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)) + .add(m_label_readSpeed, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)) + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) + .add(m_panel_controlAreaLayout.createSequentialGroup() + .add(21, 21, 21) + .add(m_label_zoomLevel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)) + .add(m_panel_controlAreaLayout.createSequentialGroup() + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(m_slider_zoomLevel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(m_panel_controlAreaLayout.createSequentialGroup() + .add(23, 23, 23) + .add(m_label_lof, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_panel_controlAreaLayout.createSequentialGroup() + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(m_slider_lof, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) + .add(16, 16, 16) + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(m_panel_controlAreaLayout.createSequentialGroup() + .add(m_label_lod, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE) + .add(18, 18, 18)) + .add(m_panel_controlAreaLayout.createSequentialGroup() + .add(m_slider_lod, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(m_panel_controlAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) + .add(m_label_lod1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(m_slider_imageSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, Short.MAX_VALUE)) + .add(20, 20, 20) .add(m_label_fgColor) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(m_button_fgColor) @@ -387,7 +443,7 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { .add(m_label_hlColor) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(m_button_hlColor) - .add(15, 15, 15) + .add(25, 25, 25) .add(m_checkBox_speechEnabled1) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(m_checkBox_showImages) @@ -395,7 +451,7 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { .add(m_checkBox_wordsGrow) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(m_checkBox_speechEnabled) - .addContainerGap(26, Short.MAX_VALUE)) + .addContainerGap()) ); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); @@ -404,19 +460,23 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(m_panel_textArea, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(1, 1, 1) - .add(m_panel_controlArea, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(m_panel_controlArea, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(m_panel_textArea, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(layout.createSequentialGroup() - .add(m_panel_controlArea, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(11, 11, 11)) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, m_panel_textArea, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(m_panel_controlArea, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) ); pack(); }// //GEN-END:initComponents + + private void m_slider_imageSizeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_m_slider_imageSizeStateChanged + ConfigurationManager.setImageScale(m_slider_imageSize.getValue()); + }//GEN-LAST:event_m_slider_imageSizeStateChanged private void m_slider_lodStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_m_slider_lodStateChanged @@ -481,7 +541,7 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS }//GEN-LAST:event_jButton1ActionPerformed private void m_slider_readSpeedStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_m_slider_readSpeedStateChanged - Player.setSleepDelay(m_slider_readSpeed.getValue()); + Player.setSleepDelay(3100-m_slider_readSpeed.getValue()); }//GEN-LAST:event_m_slider_readSpeedStateChanged private void m_buton_stopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_buton_stopActionPerformed @@ -614,11 +674,14 @@ private void m_button_playActionPerformed(java.awt.event.ActionEvent evt) {//GEN private javax.swing.JLabel m_label_fgColor; private javax.swing.JLabel m_label_hlColor; private javax.swing.JLabel m_label_lod; + private javax.swing.JLabel m_label_lod1; private javax.swing.JLabel m_label_lof; private javax.swing.JLabel m_label_readSpeed; + private javax.swing.JLabel m_label_readSpeed1; private javax.swing.JLabel m_label_zoomLevel; private javax.swing.JPanel m_panel_controlArea; private javax.swing.JPanel m_panel_textArea; + private javax.swing.JSlider m_slider_imageSize; private javax.swing.JSlider m_slider_lod; private javax.swing.JSlider m_slider_lof; private javax.swing.JSlider m_slider_readSpeed;