Setting scroll pane initial display size

hello.
how can i modify the modified code below so that users of my video library system would be able to view CD/DVD/Game information by name, age category, type and year? the text area is not displaying in a proper size - i have to use the scroll pane to view the data in the text area. i should be able to view the data in the text area without a scrollpane because there is not much data in the database. how can i make the text area bigger?
thanks.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class ViewProductDetails extends JFrame{
   JPanel pnlBox, pnlBody, pnlFooter; 
   JCheckBox name;
   JCheckBox ageCategory;
   JCheckBox type;
   JCheckBox year;
   JButton returnToProductMenu;
   JTextArea jta;
   Container contentpane;
   Connection db;
   Statement statement;
   public void makeConnection(){
      try{
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      catch(Exception e){
           System.out.println("Problem loading the driver");
   public void setHostURL(){
      String url = "jdbc:odbc:VideoLibrary";
      closeDB();
      try{
         db = DriverManager.getConnection(url,"","");
         statement = db.createStatement();
         DatabaseMetaData dbmd = db.getMetaData();
         ResultSet rs = dbmd.getTables(null, null, null, new String[]{"TABLE"});
      catch(Exception e){
           System.out.println("Could not initialise the database");
           e.printStackTrace();
   public void selectProductOne(){
      try{
         ResultSet rs1 = statement.executeQuery("SELECT * FROM Product ORDER BY name");
         ResultSetMetaData rsmd1 = rs1.getMetaData();
         for(int i = 1; i <= rsmd1.getColumnCount(); i++){
            jta.append(rsmd1.getColumnName(i) + "    ");
         jta.append("\n");
         while(rs1.next()){
            for(int i = 1; i <= rsmd1.getColumnCount(); i++){
               jta.append(rs1.getObject(i) + "     ");
            jta.append("\n");
      catch(SQLException ea){
         ea.printStackTrace();
   public void selectProductTwo(){
      try{
         ResultSet rs2 = statement.executeQuery("SELECT * FROM Product ORDER BY ageCategory");
         ResultSetMetaData rsmd2 = rs2.getMetaData();
         for(int i = 1; i <= rsmd2.getColumnCount(); i++){
            jta.append(rsmd2.getColumnName(i) + "    ");
         jta.append("\n");
         while(rs2.next()){
            for(int i = 1; i <= rsmd2.getColumnCount(); i++){
               jta.append(rs2.getObject(i) + "     ");
            jta.append("\n");
      catch(SQLException eb){
         eb.printStackTrace();
   public void selectProductThree(){
      try{
         ResultSet rs3 = statement.executeQuery("SELECT * FROM Product ORDER BY type");
         ResultSetMetaData rsmd3 = rs3.getMetaData();
         for(int i = 1; i <= rsmd3.getColumnCount(); i++){
            jta.append(rsmd3.getColumnName(i) + "    ");
         jta.append("\n");
         while(rs3.next()){
            for(int i = 1; i <= rsmd3.getColumnCount(); i++){
               jta.append(rs3.getObject(i) + "     ");
            jta.append("\n");
      catch(SQLException ec){
         ec.printStackTrace();
   public void selectProductFour(){
      try{
         ResultSet rs4 = statement.executeQuery("SELECT * FROM Product ORDER BY year");
         ResultSetMetaData rsmd4 = rs4.getMetaData();
         for(int i = 1; i <= rsmd4.getColumnCount(); i++){
            jta.append(rsmd4.getColumnName(i) + "    ");
         jta.append("\n");
         while(rs4.next()){
            for(int i = 1; i <= rsmd4.getColumnCount(); i++){
               jta.append(rs4.getObject(i) + "     ");
            jta.append("\n");
      catch(SQLException ed){
         ed.printStackTrace();
   public void closeDB(){
      try{
         if(statement != null){
            statement.close();
         if(db != null){
            db.close();
      catch(Exception e){
         System.out.println("Could not close the current connection");
         e.printStackTrace();
   public ViewProductDetails(){
      super("View Product Details");
      contentpane = getContentPane();
      contentpane.setLayout(new BorderLayout());
      pnlBox = new JPanel();
      pnlBody = new JPanel();
      pnlFooter = new JPanel();
      jta = new JTextArea();
      jta.setFont(new Font("Serif", Font.PLAIN, 12));
      jta.setLineWrap(true);
      jta.setWrapStyleWord(true);
      jta.setEditable(false);
      name = new JCheckBox("Name");
      ageCategory = new JCheckBox("Age Category");
      type = new JCheckBox("Type");
      year = new JCheckBox("Year");
      pnlBox.add(name);
      pnlBox.add(ageCategory);
      pnlBox.add(type);
      pnlBox.add(year);
      JScrollPane jsp = new JScrollPane(jta);
      pnlBody.add(jsp, BorderLayout.CENTER);
      returnToProductMenu = new JButton("Return To Product Menu");
      pnlFooter.add(returnToProductMenu);
      contentpane.add(pnlBox,BorderLayout.NORTH);
      contentpane.add(pnlBody,BorderLayout.CENTER);
      contentpane.add(pnlFooter,BorderLayout.SOUTH);
      pack();
      setLocationRelativeTo(null);
      setVisible(true);
      name.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            makeConnection();
            setHostURL();
            selectProductOne();
            closeDB();
      ageCategory.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            makeConnection();
            setHostURL();
            selectProductTwo();
            closeDB();
      type.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            makeConnection();
            setHostURL();
            selectProductThree();
            closeDB();  
      year.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            makeConnection();
            setHostURL();
            selectProductFour();
            closeDB();     
      returnToProductMenu.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            setVisible(false);
   public static void main(String[] args){
      new ViewProductDetails();
}

hello.
thanks for the reply. i did what you told me to do. but when i compile the program i get the following error (both error + code are shown below).
----jGRASP exec: javac -g E:\CP4B Project\ViewProductDetails.java
ViewProductDetails.java:174: cannot find symbol
symbol : method setPreferredSize()
location: class javax.swing.JScrollPane
jsp.setPreferredSize();
^
1 error
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class ViewProductDetails extends JFrame{
   JPanel pnlBox, pnlBody, pnlFooter; 
   JCheckBox name;
   JCheckBox ageCategory;
   JCheckBox type;
   JCheckBox year;
   JButton returnToProductMenu;
   JTextArea jta;
   Container contentpane;
   Connection db;
   Statement statement;
   public void makeConnection(){
      try{
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      catch(Exception e){
           System.out.println("Problem loading the driver");
   public void setHostURL(){
      String url = "jdbc:odbc:VideoLibrary";
      closeDB();
      try{
         db = DriverManager.getConnection(url,"","");
         statement = db.createStatement();
         DatabaseMetaData dbmd = db.getMetaData();
         ResultSet rs = dbmd.getTables(null, null, null, new String[]{"TABLE"});
      catch(Exception e){
           System.out.println("Could not initialise the database");
           e.printStackTrace();
   public void selectProductOne(){
      try{
         ResultSet rs1 = statement.executeQuery("SELECT * FROM Product ORDER BY name");
         ResultSetMetaData rsmd1 = rs1.getMetaData();
         for(int i = 1; i <= rsmd1.getColumnCount(); i++){
            jta.append(rsmd1.getColumnName(i) + "    ");
         jta.append("\n");
         while(rs1.next()){
            for(int i = 1; i <= rsmd1.getColumnCount(); i++){
               jta.append(rs1.getObject(i) + "     ");
            jta.append("\n");
      catch(SQLException ea){
         ea.printStackTrace();
   public void selectProductTwo(){
      try{
         ResultSet rs2 = statement.executeQuery("SELECT * FROM Product ORDER BY ageCategory");
         ResultSetMetaData rsmd2 = rs2.getMetaData();
         for(int i = 1; i <= rsmd2.getColumnCount(); i++){
            jta.append(rsmd2.getColumnName(i) + "    ");
         jta.append("\n");
         while(rs2.next()){
            for(int i = 1; i <= rsmd2.getColumnCount(); i++){
               jta.append(rs2.getObject(i) + "     ");
            jta.append("\n");
      catch(SQLException eb){
         eb.printStackTrace();
   public void selectProductThree(){
      try{
         ResultSet rs3 = statement.executeQuery("SELECT * FROM Product ORDER BY type");
         ResultSetMetaData rsmd3 = rs3.getMetaData();
         for(int i = 1; i <= rsmd3.getColumnCount(); i++){
            jta.append(rsmd3.getColumnName(i) + "    ");
         jta.append("\n");
         while(rs3.next()){
            for(int i = 1; i <= rsmd3.getColumnCount(); i++){
               jta.append(rs3.getObject(i) + "     ");
            jta.append("\n");
      catch(SQLException ec){
         ec.printStackTrace();
   public void selectProductFour(){
      try{
         ResultSet rs4 = statement.executeQuery("SELECT * FROM Product ORDER BY year");
         ResultSetMetaData rsmd4 = rs4.getMetaData();
         for(int i = 1; i <= rsmd4.getColumnCount(); i++){
            jta.append(rsmd4.getColumnName(i) + "    ");
         jta.append("\n");
         while(rs4.next()){
            for(int i = 1; i <= rsmd4.getColumnCount(); i++){
               jta.append(rs4.getObject(i) + "     ");
            jta.append("\n");
      catch(SQLException ed){
         ed.printStackTrace();
   public void closeDB(){
      try{
         if(statement != null){
            statement.close();
         if(db != null){
            db.close();
      catch(Exception e){
         System.out.println("Could not close the current connection");
         e.printStackTrace();
   public ViewProductDetails(){
      super("View Product Details");
      contentpane = getContentPane();
      contentpane.setLayout(new BorderLayout());
      pnlBox = new JPanel();
      pnlBody = new JPanel();
      pnlFooter = new JPanel();
      jta = new JTextArea();
      jta.setFont(new Font("Serif", Font.PLAIN, 12));
      jta.setLineWrap(true);
      jta.setWrapStyleWord(true);
      jta.setEditable(false);
      name = new JCheckBox("Name");
      ageCategory = new JCheckBox("Age Category");
      type = new JCheckBox("Type");
      year = new JCheckBox("Year");
      pnlBox.add(name);
      pnlBox.add(ageCategory);
      pnlBox.add(type);
      pnlBox.add(year);
      JScrollPane jsp = new JScrollPane(jta);
      jsp.setPreferredSize();
      pnlBody.add(jsp, BorderLayout.CENTER);
      returnToProductMenu = new JButton("Return To Product Menu");
      pnlFooter.add(returnToProductMenu);
      contentpane.add(pnlBox,BorderLayout.NORTH);
      contentpane.add(pnlBody,BorderLayout.CENTER);
      contentpane.add(pnlFooter,BorderLayout.SOUTH);
      pack();
      setLocationRelativeTo(null);
      setVisible(true);
      name.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            makeConnection();
            setHostURL();
            selectProductOne();
            closeDB();
      ageCategory.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            makeConnection();
            setHostURL();
            selectProductTwo();
            closeDB();
      type.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            makeConnection();
            setHostURL();
            selectProductThree();
            closeDB();  
      year.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            makeConnection();
            setHostURL();
            selectProductFour();
            closeDB();     
      returnToProductMenu.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent e){
            setVisible(false);
   public static void main(String[] args){
      new ViewProductDetails();
}

Similar Messages

  • How to set PDF file default display size through Report Writter 6i

    Anyone could help me, how to setup default display (magnification i.e 100% or 80%) for a pdf file generated by report writter 6i.
    Thanks
    Raj

    hi,
    regarding report, there is a dedicated report forum. you should post there.
    but answer for your question is form is nothing to do with the pdf generation. you can call the report from the as usual.
    In the report you should set the properties like
    destype to 'file'
    desname to 'path with file name'
    desformat to 'pdf'

  • VNC/Remote Management display size setting?

    I'm not sure the best place to ask this question, it has several different components involved in it. I've looked all over but can't seem to find any info on this.
    I've got a headless Mini running 10.5.1. When I use a VNC client or now "Share Screen" to it, it comes up with a screen size of 1680 x 1050. Back when it was running Tiger it was something smaller (but can't remember what it was right now).
    Question is... how is this size set and is it changeable?
    Thanks,
    Rich

    Sorry, I guess I should have been more specific, how do you set it to other display sizes besides the ones that are listed in Sys Prefs? What if I want to make it bigger than 1860 x1050 (which is the biggest listed)? I'm connecting from a Mac that has a 30" display, so what if I want to make it closer to that display's size, which is 2560 x 1600? How was 1680 x 1050 even picked in the first place? I do not have a monitor attached at all, let alone that size.

  • Need help with a scroll pane

    Hello all. I am trying to get a scroll pane to work in an application that I have built for school. I am trying to get an amortization table to scroll through for a mortgage calculator. It isn't recognizing my scrollpane and I am not sure why. Could someone give me a push in the right direction.
    import javax.swing.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.*;
    public class MortCalcWeek3 extends JFrame implements ActionListener
         DecimalFormat twoPlaces = new DecimalFormat("#,###.00");//number format
         int L[] = {7, 15, 30};
         double I[] = {5.35, 5.5, 5.75};
         double P, M, J, H, C, Q;
         JPanel panel = new JPanel ();//creates the panel for the GUI
         JLabel title = new JLabel("Mortgage Calculator");
         JLabel PLabel = new JLabel("Enter the mortgage amount: ");
         JTextField PField = new JTextField(10);//field for obtaining user input for mortgage amount
         JLabel choices = new JLabel ("Choose the APR and Term in Years");
         JTextField choicestxt = new JTextField (0);
         JButton calcButton = new JButton("Calculate");
         JTextField payment = new JTextField(10);
         JLabel ILabel = new JLabel("Annual Percentage Rate: choose one");
         String [] IChoice = {I[0] + "", I[1] + "", I[2] + ""};
         JComboBox IBox = new JComboBox(IChoice);
         JLabel LLabel = new JLabel("Term (in years): choose one");
         String [] LChoice = {L[0] + "", L[1] + "", L[2] + ""};
         JComboBox LBox = new JComboBox(LChoice);
         JLabel amortBox = new JLabel("Amortiaztion Table");
         JScrollPane amortScroll = new JScrollPane(amortBox);
         public MortCalcWeek3 () //creates the GUI window
                        super("Mortgage Calculator");
                        setSize(300, 400);
                        setBackground (Color.white);
                        setForeground(Color.blue);
                        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        //Creates the container
                        Container contentPane = getContentPane();
                        FlowLayout fresh = new FlowLayout(FlowLayout.LEFT);
                        panel.setLayout(fresh);
                        //identifies trigger events
                        calcButton.addActionListener(this);
                        PField.addActionListener(this);
                        IBox.addActionListener(this);
                        LBox.addActionListener(this);
                        panel.add(PLabel);
                        panel.add(PField);
                        panel.add(choices);
                        panel.add(choicestxt);
                        panel.add(ILabel);
                        panel.add(IBox);
                        panel.add(LLabel);
                        panel.add(LBox);
                        panel.add(calcButton);
                        panel.add(payment);
                        panel.add(amortBox);
                        payment.setEditable(false);
                        panel.add(amortScroll);
                        setContentPane(panel);
                        setVisible(true);
         }// end of GUI info
              public void actionPerformed(ActionEvent e) {
                   MortCalcWeek3();     //calls the calculations
              public void MortCalcWeek3() {     //performs the calculations from user input
                   double P = Double.parseDouble(PField.getText());
                   double I = Double.parseDouble((String) IBox.getSelectedItem());
                   double L = Double.parseDouble((String) LBox.getSelectedItem());
                   double J = (I  / (12 * 100));//monthly interest rate
                   double N = (L * 12);//term in months
                   double M = (P * J) / (1 - Math.pow(1 + J, - N));//Monthly Payment
                 String showPayment = twoPlaces.format(M);
                 payment.setText(showPayment);
         //public void amort() {
                   //int N = (L * 12);
                   int month = 1;
                             while (month <= N)
                                  //performs the calculations for the amortization
                                  double H = P * J;//current monthly interest
                                  double C = M - H;//monthly payment minus monthly interest
                                  double Q = P - C;//new balance
                                  P = Q;//sets loop
                                  month++;
                                  String showAmort = twoPlaces.format(H + C + Q);
                                amortScroll(showAmort);
              public static void main(String[] args) {
              MortCalcWeek3 app = new MortCalcWeek3();
    }//end main
    }//end the programI appreciate any help you may provide.

         JLabel amortBox = new JLabel("Amortiaztion Table");
         JScrollPane amortScroll = new JScrollPane(amortBox);The argument passed to a JScrollPane constructor specifies what's inside the scroll pane. Here, it seems like you're trying to create a scroll pane that displays a JLabel.
    Also, I'm not sure what you're trying to do here:
    amortScroll(showAmort);I don't see a method named "amortScroll".
    You need to make a JTextArea, pass that into the JScrollPane's constructor, and add the JScrollPane to your frame.

  • How to set the display size of the PDF - in percent?

    Hi, I wonder if anyone knows if it is possible to set
    the display size of the PDF document, so that it always
    shows in, let´s say 100%, in the viewers browser window?
    Much grateful for any help!
    /Anni

    In Acrobat, under Document Properties (Ctrl+D), you can edit the Initial
    View settings, including the zoom level.

  • How to set display size of a Region or Dynamic Region?

    Hi,experts,
    In jdev 11.1.2.3,
    I drag and drop a task-flow into a jsf page to create a Region,
    and set display size for the region, source code as:
    ===================
    <f:facet name="second">
    <af:decorativeBox theme="medium" id="db1">
    <f:facet name="center">
    <af:panelGroupLayout layout="scroll" id="pgl1"
    inlineStyle="width:1200px;height:700px;">
    <af:region value="#{bindings.trainflow11.regionModel}" id="r1"
    inlineStyle="width:1200px;height:700px;"/>
    </af:panelGroupLayout>
    </f:facet>
    </af:decorativeBox>
    </f:facet>
    =================
    But, the Region is only showed a small fraction area on the parent jsf page whenever during design or run time.
    How to set display size of a Region or Dynamic Region?
    Thanks!

    Hi,
    the decorative box is supposed to stretch components in the center facet, so at runtime the region should stretch. Can you try with a static region to see if this is an issue with dynamic regions?
    Frank

  • How to set a uniform display size of multiple intermedia image types - wher

    I have read "If you want to limit the size of the file that can be uploaded, you can do this as a post generation
    step, by adding the maxFileSize property to the <controller> element in the struts-config:
    This does not address how to limit the *** display size *** where you have multiple intermedia image types - where the original size is not uniform.
    If an image is uploaded where the true image display size is 1024 x 768 - it will display that way in the table/table-form. This will create un-even display size's where previous images sizes where different 384 x 384 and so on.
    Is there a way to encode the display size so that *** ALL *** images regardless of their true size are displayed uniformly at least on one dimension (64 x ???)? This is possible when using products such as Dreamweaver or Flash.
    BTW - JHS/***JDev*** synergy is truely magnificient!!! Way-To-Go Oracle!!!!!!!!!!! Keep it up!!!!
    BG...

    Bill,
    I did some tests, and was able to reproduce it. The problem is that JHeadstart distinguishes between display types fileDownload and image, but UIX uses the same <media> tag to handle both display types. It will look at runtime whether it must render a hyperlink to download the document, or to render it right away as an image.
    To get all images the same size, you can set the display width and height, AND the display type must be set to image.
    However, to get the file name used as download link, you must set the FileName attribute AND the display type must be set to "fileDownload" ..
    So, to solve your problem, it is easiest to set the displayType to "fileDownload" and set the width and height properties post-generation in the generated UIX page.
    In the next release of Jheadstart, we will fix this, and always pick up width, height and fileName settings regardless of the display type.
    Note that you should also set the FileName property against the attribute you are using to upload the file.
    Steven Davelaar,
    JHeadstart Team.

  • Setting Display Size in X

    Connecting a laptop to a new 42" Panasonic monitor (TC-L42E60), I found
    the display to be blurry.
    xrandr shows this line:
    HDMI2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 698mm x 392mm
    Use the same hardware, on my co-worker's older 42" monitor, I see:
    HDMI2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 930mm x 520mm
    A physical size of 698mm x 392mm is closer to 32".  I assume there is a
    problem with the monitor's EDID (the monitor's firmware is up to date).
    Does anyone know how to manually set the physical size?  I fiddled
    around with 'xrandr --fbmm' but to no avail.

    Before making changes, I see these two lines in the output of xrandr:
    LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 277mm x 156mm
    HDMI2 connected 1366x768+0+0 (normal left inverted right x axis y axis) 698mm x 392mm
    And this information from Xorg.log:
    $ grep monitor /var/log/Xorg.0.log
    [225833.747] (**) | |-->Monitor "<default monitor>"
    [225833.747] (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
    [225833.763] (II) intel(0): Output LVDS1 has no monitor section
    [225833.763] (II) intel(0): Output VGA1 has no monitor section
    [225834.294] (II) intel(0): Output HDMI1 has no monitor section
    [225834.334] (II) intel(0): Output DP1 has no monitor section
    [225834.579] (II) intel(0): Output HDMI2 has no monitor section
    [225834.602] (II) intel(0): Output HDMI3 has no monitor section
    [225834.640] (II) intel(0): Output DP2 has no monitor section
    [225834.680] (II) intel(0): Output DP3 has no monitor section
    [225835.499] (II) intel(0): Monitor name: Panasonic-TV
    I then created this file:
    $ vim /etc/X11/xorg.conf.d/90-monitor.conf
    Section "Monitor"
    Identifier "<default monitor>"
    DisplaySize 930 520 # In millimeters
    EndSection
    I now see this in Xorg.log:
    $ grep monitor /var/log/Xorg.0.log
    [226022.950] (**) | |-->Monitor "<default monitor>"
    [226022.951] (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
    [226022.962] (II) intel(0): Output LVDS1 using monitor section <default monitor>
    [226022.963] (II) intel(0): Output VGA1 has no monitor section
    [226023.494] (II) intel(0): Output HDMI1 has no monitor section
    [226023.534] (II) intel(0): Output DP1 has no monitor section
    [226023.779] (II) intel(0): Output HDMI2 has no monitor section
    [226023.802] (II) intel(0): Output HDMI3 has no monitor section
    [226023.840] (II) intel(0): Output DP2 has no monitor section
    [226023.880] (II) intel(0): Output DP3 has no monitor section
    [226024.699] (II) intel(0): Monitor name: Panasonic-TV
    But in the output of xrandr, I see no change to the display size:
    LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 277mm x 156mm
    HDMI2 connected 1366x768+0+0 (normal left inverted right x axis y axis) 698mm x 392mm
    I understand my laptop screen is LVDS1 but I was hoping to see have a
    display size of 930mm x 520mm.
    1) Does anyone know how to define HDMI2 in
    /etc/X11/xorg.conf.d/90-monitor.conf ?
    2) Does anyone know how to override the DisplaySize?
    Maybe if I get '1' to work, '2' will follow, but I figured I'd ask.
    -steve

  • Setting my display size to "Best for Retina Display" creates a host of problems.

    When I go into System Preferences>Displays>Set Best for Retina Displays, my typical web pages are scaled a bit too large to fit on the screen and I'm constanty having to scroll left/right to all the information. On top of that, if I click on a link, e.g., click on YouTube video, the resulting screen is shrunk to occupy only a small portion of the screen, and is much too small to read/view.  This is a new phenomenon and hasn't always been this way.  Any ideas?

    Which os version are you using? 
    Does this happen in all browsers? 
    You are still under warranty.  Call Apple Care and get your monies worth before it runs out. 

  • New to Applets: Problems wiht writing to files and with scroll panes.

    Hi, I've recently graduated from university and so I have limited experience in java programming and I'm having some trouble with JApplets (this is the first time I've made one). I'm trying to make a simple program that will allow users to pick one of a few background images from a list (a list of jpanels within a scroll pane) then at the click of a button will output a CSS with the background tag set to the image location. This is for use on a microsoft sharepoint site where each user has a My-Sit area which I want to be customizable.
    So far I've been creating this program as an application rather than a JApplet and just having another class that extends the JApplet Class which then displays the JFrame from the GUI Class. This initially didnt work because I was trying to add a window to a container so I kept programming it as an application until I got it working before trying to convert it to a JApplet. I solved the previous problem by changing my GUI class to extend JPanel instead of JFrame and it now displays correctly but with a coupe of issues.
    Firstly the applet will not create/write to the CSS file. I read that applets couldnt read/write to the users file system but they could to their own. The file I wish to write to is kept on the same machine as the applet so I'm not sure why this isn't working.
    Secondly the scroll panel is no longer working properly. This worked fine when I was still running the program as an application when the GUI still extended JFrame instead of JPanel (incidentally the program no longer runs as an application in this state) but now the scroll bar does not appear. This is a problem since I want the applet to remain the same size on the page even if I decide to add more backgrounds to the list. I tried setting the applet height/width to smaller values in the html file to see if the scroll bar would appear if the area was smaller than the GUI should be, but this just meant the bottom off the applet was cut off.
    Could anyone offer any suggestion as to why these thigns arnt working and how to fix them? If necessary I can post my source code here. Thanks in advance.

    Ok, well my program is made up of 4 classes, I hope this isnt too much to be posting. If any explaination is needed then I'll post that next. Theres lots of print lines scattered aroudn due to me trying to fix this and theres some stuff commented out from when the program used to be an application isntead of an applet.
    GUI Class, this was the main class until I made a JApplet Class
    public class AppletGUI extends JPanel{
        *GUI Components*
        //JFrames
        JFrame mainGUIFrame = new JFrame();
        JFrame changeBackgroundFrame = new JFrame();
        //JPanels (Sub-panels are indented)
        JPanel changeBackgroundJP = new JPanel(new BorderLayout());
            JPanel changeBackgroundBottomJP = new JPanel(new GridLayout(1,2));
        JPanel backgroundJP = new JPanel(new GridLayout(1,2));
        JPanel selectBackground = new JPanel(new GridLayout(1,2));
        //Jbuttons
        JButton changeBackgroundJB = new JButton("Change Background");
        JButton defaultStyleJB = new JButton("Reset Style");
        //JLabels
        JLabel changeBackgroundJL = new JLabel("Choose a Background from the Menu");
        JLabel backgroundJL = new JLabel();
        //JScrollPane
        JScrollPane backgroundList = new JScrollPane();
            JPanel backgroundListPanel = new JPanel(new GridLayout());
        //Action Listeners
        ButtonListener bttnLstnr = new ButtonListener();
        //Controllers
        CSSGenerator cssGenerator = new CSSGenerator();
        Backgrounds backgroundsController = new Backgrounds();
        backgroundMouseListener bgMouseListener = new backgroundMouseListener();
        //Flags
        Component selectedComponent = null;
        *Colour Changer*
        //this method is used to change the colour of a selected JP
        //selected JPs have their background darkered and when a
        //different JP is selected the previously seleced JP has its
        //colour changed back to it's original.
        public void changeColour(JPanel theJPanel, boolean isDarker){
        //set selected JP to a different colour
        Color tempColor = theJPanel.getBackground();
            if(isDarker){
                tempColor = tempColor.darker();
            else{
                tempColor = tempColor.brighter();
            theJPanel.setBackground(tempColor);
         //also find any sub-JPs and change their colour to match
         int j = theJPanel.getComponents().length;
         for(int i = 0; i < j; i++){
                String componentType = theJPanel.getComponent(i).getClass().getSimpleName();
                if(componentType.equals("JPanel")){
                    theJPanel.getComponent(i).setBackground(tempColor);
        *Populating the GUI*
        //backgroundList.add();
        //Populating the Backgrounds List
        *Set Component Size Method*
        public void setComponentSize(Component component, int width, int height){
        Dimension tempSize = new Dimension(width, height);
        component.setSize(tempSize);
        component.setMinimumSize(tempSize);
        component.setPreferredSize(tempSize);
        component.setMaximumSize(tempSize);     
        *Constructor*
        public AppletGUI() {
            //REMOVED CODE
            //AppletGUI.setDefaultLookAndFeelDecorated(true);
            //Component Sizes
            //setComponentSize
            //Adding Action Listeners to Components
            System.out.println("adding actions listeners to components");
            changeBackgroundJB.addActionListener(bttnLstnr);
            defaultStyleJB.addActionListener(bttnLstnr);
            //Populating the Change Background Menu
            System.out.println("Populating the window");
            backgroundsController.populateBackgroundsData();
            backgroundsController.populateBackgroundsList();
            //loops to add background panels to the JSP
            ArrayList<JPanel> tempBackgroundsList = new ArrayList<JPanel>();
            JPanel tempBGJP = new JPanel();
            tempBackgroundsList = backgroundsController.getBackgroundsList();
            int j = tempBackgroundsList.size();
            JPanel backgroundListPanel = new JPanel(new GridLayout(j,1));
            for(int i = 0; i < j; i++){
                tempBGJP = tempBackgroundsList.get(i);
                System.out.println("Adding to the JSP: " + tempBGJP.getName());
                //Add Mouse Listener
                tempBGJP.addMouseListener(bgMouseListener);
                backgroundListPanel.add(tempBGJP, i);
            //set viewpoing
            backgroundList.setViewportView(backgroundListPanel);
            /*TESTING
            System.out.println("\n\n TESTING!\n Printing Content of SCROLL PANE \n");
            j = tempBackgroundsList.size();
            for(int i = 0; i < j; i++){
                System.out.println(backgroundList.getComponent(i).getName());
            changeBackgroundJP.add(changeBackgroundJL, BorderLayout.NORTH);
            changeBackgroundJP.add(backgroundList, BorderLayout.CENTER);
            //changeBackgroundJP.add(tempBGJP, BorderLayout.CENTER);
            changeBackgroundJP.add(changeBackgroundBottomJP, BorderLayout.SOUTH);
            changeBackgroundBottomJP.add(changeBackgroundJB);
            changeBackgroundBottomJP.add(defaultStyleJB);
            System.out.println("Finsihed populating");
            //REMOVED CODE
            //adding the Background Menu to the GUI and settign the GUI options
            //AppletGUI.setDefaultLookAndFeelDecorated(true);
            //this.setResizable(true);
            //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setLocation(500,500);
            this.setSize(400,300);
            this.add(changeBackgroundJP);
        //REMOVED CODE
         *Main Method*
        public static void main(String[] args){
           System.out.println("Creating GUI");
           AppletGUI theGUI = new AppletGUI();
           theGUI.setVisible(true);
           System.out.println("GUI Displayed");
         *Button Listener Inner Class*
        public class ButtonListener implements ActionListener{
            //check which button is clicked
            public void actionPerformed(ActionEvent event) {
                AbstractButton theButton = (AbstractButton)event.getSource();
                //Default Style Button
                if(theButton == defaultStyleJB){
                    System.out.println("Default Style Button Clicked!");
                //Change Background Button
                if(theButton == changeBackgroundJB){
                    System.out.println("Change Background Button Clicked!");
                    String backgroundURL = cssGenerator.getBackground();
                    if(backgroundURL != ""){
                        cssGenerator.setBackgroundChanged(true);
                        cssGenerator.setBackground(backgroundURL);
                        cssGenerator.outputCSSFile();
                        System.out.println("Backgroudn Changed, CSS File Written");
                    else{
                        System.out.println("No Background Selected");
         *Mouse Listener Inner Class*
        public class backgroundMouseListener implements MouseListener{
            public void mouseClicked(MouseEvent e){
                //get component
                JPanel tempBackgroundJP = new JPanel();
                tempBackgroundJP = (JPanel)e.getComponent();
                System.out.println("Background Panel Clicked");
                //change component colour
                if(selectedComponent == null){
                    selectedComponent = tempBackgroundJP;
                else{
                    changeColour((JPanel)selectedComponent, false);
                    selectedComponent = tempBackgroundJP;
                changeColour((JPanel)selectedComponent, true);
                //set background URL
                cssGenerator.setBackground(tempBackgroundJP.getName());
            public void mousePressed(MouseEvent e){
            public void mouseReleased(MouseEvent e){
            public void mouseEntered(MouseEvent e){
            public void mouseExited(MouseEvent e){
    }JApplet Class, this is what I plugged the GUI into after I made the change from Application to JApplet.
    public class AppletTest extends JApplet{
        public void init() { 
            System.out.println("Creating GUI");
            AppletGUI theGUI = new AppletGUI();
            theGUI.setVisible(true);
            Container content = getContentPane();
            content.setBackground(Color.white);
            content.setLayout(new FlowLayout());
            content.add(theGUI);
            AppletGUI theGUI = new AppletGUI();
            theGUI.setVisible(true);
            setContentPane(theGUI);
            System.out.println("GUI Displayed");
        public static void main(String[] args){
            AppletTest at = new AppletTest();
            at.init();
            at.start();
    }The CSS Generator Class. This exists because once I have the basic program working I intend to expand upon it and add multiple tabs to the GUI, each one allowing the user to change different style options. Each style option to be changed will be changed wit ha different method in this class.
    public class CSSGenerator {
        //Variables
        String background = "";
        ArrayList<String> backgroundCSS;
        //Flags
        boolean backgroundChanged = false;
        //Sets and Gets
        //For Variables
        public void setBackground(String theBackground){
            background = theBackground;
        public String getBackground(){
            return background;
        //For Flags
        public void setBackgroundChanged(boolean isBackgroundChanged){
            backgroundChanged = isBackgroundChanged;
        public boolean getBackgroundChanged(){
            return backgroundChanged;
        //background generator
        public ArrayList<String> backgroundGenerator(String backgroundURL){
            //get the URL for the background
            backgroundURL = background;
            //creat a new array list of strings
            ArrayList<String> backgroundCSS = new ArrayList<String>();
            //add the strings for the background options to the array list
            backgroundCSS.add("body");
            backgroundCSS.add("{");
            backgroundCSS.add("background-image: url(" + backgroundURL + ");");
            backgroundCSS.add("background-color: #ff0000");
            backgroundCSS.add("}");
            return backgroundCSS;
        //Write CSS to File
        public void outputCSSFile(){
            try{
                //Create CSS file
                System.out.print("creating file");
                FileWriter cssWriter = new FileWriter("C:/Documents and Settings/Gwilym/My Documents/Applet Data/CustomStyle.css");
                System.out.print("file created");
                System.out.print("creating buffered writer");
                BufferedWriter out = new BufferedWriter(cssWriter);
                System.out.print("buffered writer created");
                //check which settings have been changed
                //check background flag
                if(getBackgroundChanged() == true){
                    System.out.print("retrieving arraylist");
                    ArrayList<String> tempBGOptions = backgroundGenerator(getBackground());
                    System.out.print("arraylist retrieved");
                    int j = tempBGOptions.size();
                    for(int i = 0; i < j ; i++){
                        System.out.print("writing to the file");
                        out.write(tempBGOptions.get(i));
                        out.newLine();
                        System.out.print("written to the file");
                out.close();
            }catch (Exception e){//Catch exception if any
                System.out.println("Error: Failed to write CSS file");
        /** Creates a new instance of CSSGenerator */
        public CSSGenerator() {
    }The Backgrounds Class. This class exists because I didnt want there to just be a hardcoded lsit of backgrounds, I wanted it to be possible to add new ones to the list without simply lettign users upload their own images (since the intended users are kids and this sharepoint site is used for educational purposes, I dont want them uplaoded inapropraite backgrounds) but I do want the site admin to be able to add more images to the list. for this reason the backgrounds are taken from a list in a text file that will be stored in the same location as the applet, the file specifies the background name, where it is stored, and where a thumbnail image is stored.
    public class Backgrounds {
        //Array Lists
        private ArrayList<JPanel> backgroundsList;
        private ArrayList<String> backgroundsData;
        //Set And Get Methods
        public ArrayList getBackgroundsList(){
            return backgroundsList;
        //ArrayList Population Methods
        public void populateBackgroundsData(){
            //decalre the input streams and create a new fiel hat points to the BackgroundsData file
            File backgroundsDataFile = new File("C:/Documents and Settings/Gwilym/My Documents/Applet Data/BackgroundsData.txt");
            FileInputStream backgroundsFIS = null;
            BufferedInputStream backgroundsBIS = null;
            DataInputStream backgroundsDIS = null;
            try {
                backgroundsFIS = new FileInputStream(backgroundsDataFile);
                backgroundsBIS = new BufferedInputStream(backgroundsFIS);
                backgroundsDIS = new DataInputStream(backgroundsBIS);
                backgroundsData = new ArrayList<String>();
                String inputtedData = null;
                //loops until it reaches the end of the file
                while (backgroundsDIS.available() != 0) {
                    //reads in the data to be stored in an array list
                    inputtedData = backgroundsDIS.readLine();
                    backgroundsData.add(inputtedData);
            //TESTING
            System.out.println("\n\nTESTING: populateBackgroundsData()");
            int j = backgroundsData.size();
            for(int i = 0; i < j; i++){
                System.out.println("Index " + i + " = " + backgroundsData.get(i));
            System.out.println("\n\n");
            //close all stremas
            backgroundsFIS.close();
            backgroundsBIS.close();
            backgroundsDIS.close();
            } catch (FileNotFoundException e) {
                System.out.println("Error: File Not Found");
            } catch (IOException e) {
                System.out.println("Error: IO Exception Thrown");
        public void populateBackgroundsList(){
            backgroundsList = new ArrayList<JPanel>();
            int j = backgroundsData.size();
            System.out.println("number of backgrounds = " + j);
            backgroundsList = new ArrayList<JPanel>();
            for(int i = 0; i < j; i++){
                String tempBackgroundData = backgroundsData.get(i);
                JPanel backgroundJP = new JPanel(new GridLayout(1,2));
                JLabel backgroundNameJL = new JLabel();               
                JLabel backgroundIconJL = new JLabel();
                //split the string string and egt the background name and URL
                String[] splitBGData = tempBackgroundData.split(",");
                String backgroundName = splitBGData[0];
                String backgroundURL = splitBGData[1];
                String backgroundIcon = splitBGData[2];
                System.out.println("\nbackgroundName = " + backgroundName);
                System.out.println("\nbackgroundURL = " + backgroundURL);
                System.out.println("\nbackgroundIcon = " + backgroundIcon + "\n");
                backgroundNameJL.setText(backgroundName);
                backgroundIconJL.setIcon(new javax.swing.ImageIcon(backgroundIcon));
                backgroundJP.add(backgroundNameJL);
                backgroundJP.add(backgroundIconJL);
                backgroundJP.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
                //Name the JP as the background URL so it can be found
                //May be useful sicne the data file may need to contain 3 fields in future
                //this is incase the preview image (icon) is different from the acctual background
                //most liekly in the case of more complex ppictures rather then repeating patterns
                backgroundJP.setName(backgroundURL);
                //Add the JP to the Array List
                backgroundsList.add(backgroundJP);
            //TESTING
            System.out.println("\n\nTESTING: populateBackgroundsList()");
            j = backgroundsList.size();
            for(int i = 0; i < j; i++){
                System.out.println("Index " + i + " = " + backgroundsList.get(i));
            System.out.println("\n\n");
    }So thats my program so far, if theres anythign that needs clarifying then please jsut ask. Thank you very much for the help!

  • Putting an image in a scroll pane

    This is probably a simple question for most of you, but I need a little bit of help. How do I put a picture in a scroll pane?
    The problem I have is that I can load an image and display it, that works fine. However, let's say I am making a new frame (I generally use JFrames), and I want to have a scroll pane in it. Let's also say I have numerous buttons around the edges (using a BorderLayout, or something). How do I load an image, draw the image on-screen and have it so that it only shows up in the scroll pane without the scrollbars disappearing?
    I try to do it now, but for some reason the scroll bars of the scroll pane never show up. I can make the entire image be displayed by dragging the window edges bigger (the normal way you make windows bigger), and then I can see the entire picture. Unfortunately, the scroll bars on the scroll pane never show up if the window is too small to display the entire image. This is very puzzling, because I really don't know what I'm doing wrong. I have tried putting a panel in the scroll pane, and drawing on the panel, but still no scroll bars show up on the scroll pane if it is not big enough to show the entire picture / panel.
    I am sure that the solution is very simple, but right now that solution eludes me.

    There's an example in the swing tutorials that seems to me to do exactly what you want.
    See if http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html does the job, (less the border layout and buttons of course, but that shouldn't be too hard once you get the scroll bars working).
    I believe the default scrollbar policy will let the scroll bars appear only when needed based on the bounds and the preferred size.
    I used the example to set up a scrolling map (still just a gif image) and it works fine. If you still have trouble, you probably need to post the relevant section of code.

  • Can't get scroll panes to scroll

    Hi,
    I have tabbed pane which have scroll panes which have (for each) a pane that has a known number of JLabels. The size of the tabbed pane and scroll panes are fixed, but the size of panes that are contained in them changes. I expected that when the size of panes become bigger then the size of the scroll pane a scroll bar would occur and do its job. But that does not happen. I use setSize method to set the size of the panes(not the scroll panes), which works fine.( I displayed the pane in a seperate window to check if it works.)
    Have any ideas what I am missing?

    My apologies.
    I am using NetBeans, and didn't change the code it created for GUI. I am inclined to beleive that it does not make errors when creating GUI components.
    Here is the method I use to populate one pane.
        public void listOffline() {
            // Clear the panel and set its size.
               // offlinePanel is the pane inside the scrollpane.
               offlinePanel.removeAll();
            offlinePanel.setSize(200, 20*offlineList.size());
            //offlinePane.setSize(200, 20*offlineList.size());
            // I need a list of strings to display.
            String[] ListString= arrayToStr(offlineList);
            int au=0;
            JLabel tempLabel;
            // Populate the list.
            for(int ii=0; ii < ListString.length; ii++) {
                // Add item number.
                if (ii%2 == 0){
                      tempLabel = new JLabel((ii/2 + 1) + ". " + ListString[ii]);
                 else {
                      tempLabel=new JLabel(ListString[ii]);
                offlinePanel.add(tempLabel);
                tempLabel.setLocation(20,20*ii);
                tempLabel.setSize(200,20);
                // Name is in blue.
                if(au%2==0) {
                    tempLabel.setForeground(java.awt.Color.BLUE);
                // Address is in green.
                else {
                    tempLabel.setForeground(new java.awt.Color(0,140,0));
                    tempLabel.setText("ftp://" + tempLabel.getText());
                    final String temp = tempLabel.getText();
                    // Open address in default browser if clicked.
                    tempLabel.setCursor(java.awt.Cursor.getPredefinedCursor(12));
                    tempLabel.addMouseListener(new java.awt.event.MouseAdapter() {
                        @Override
                        public void mouseClicked(java.awt.event.MouseEvent evt) {
                            try {
                                Runtime.getRuntime().exec(new String[]{"cmd", "/c", "start " + temp});
                            catch (Exception e) {
                                JOptionPane.showMessageDialog(null, "Error opening browser.");
                au++;
            ListString = null;
        }Edited by: acsabir on Oct 23, 2008 1:50 AM

  • Can't get panes to re-size with hotkeys

    I have a small annoyance whereby sometimes my hotkeys to re-size existing panes doesn't work.  I had changed the hotkeys to move from pane to pane to be Alt-Left (arrow) and Alt-Right (arrow) key.  After looking at the default settings by running tmux's in-pane help (the hotkey shift-?) I commented those two keys out thinking that would reset tmux to its default behaviour.  It hasn't worked so far and I'm not sure where else to look aside from my .tmux.conf file.  It's based on Thayer's own config:
    #~/.tmux.conf - tmux terminal multiplexer config
    # Based heavily on Thayer Williams' (http://cinderwick.ca)
    ## Environmental Options
    # Enable tmux to use a 256 colour terminal
    # Provided the underlying terminal supports 256 colours, it is usually sufficient to add the following to ~/.tmux.conf:
    set -g default-terminal "screen-256color"
    set -g terminal-overrides 'xterm*:smcup@:rmcup@'
    # If you SSH into a host in a tmux window, you'll notice the window title of your terminal emulator remains to be user@localhost
    # rather than user@server. To allow the title bar to adapt to whatever host you connect to, set the following in ~/.tmux.conf
    set -g set-titles on
    set -g set-titles-string "#T"
    # open a man page in new window
    bind m command-prompt "split-window 'exec man %%'"
    ## By default, all windows in a session are constrained to the size of the
    ## smallest client connected to that session, even if both clients are
    ## looking at different windows. It seems that in this particular case, Screen
    ## has the better default where a window is only constrained in size if a
    ## smaller client is actively looking at it. This behaviour can be fixed by
    ## setting tmux's aggressive-resize option.
    setw -g aggressive-resize on
    # mouse-select-pane [on | off]
    # # If on, tmux captures the mouse and when a window is
    # # split into multiple panes the mouse may be used to
    # # select the current pane. The mouse click is also
    # # passed through to the application as normal.
    set -g mouse-select-pane on
    ## Upon starting to use tmux, I noticed that I had to add a noticeable delay
    ## between two characters in a command sequence for it to recognize the
    ## command, for example between the C-a and n in C-a n. This is because tmux is
    ## waiting for an escape sequence. Fix that by setting escape time to zero.
    set -s escape-time 0
    ### Hotkeys and Commands
    ## Binds
    # set prefix key to ctrl+a
    unbind C-b
    set -g prefix C-a
    ## Quick way to mosh/ssh into another system bound to S [Shift-S]
    bind S command-prompt -p 'SSH to:' "new-window -n %1 'mosh %1'"
    # reload config without killing server
    bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
    # toggle last window like screen
    bind-key C-a last-window
    # more intuitive keybindings for splitting
    unbind %
    bind v split-window -v
    bind - split-window -v
    unbind '"'
    bind h split-window -h
    bind \ split-window -h
    # send the prefix to client inside window (ala nested sessions)
    bind-key a send-prefix
    # confirm before killing a window or the server
    bind-key k confirm kill-window
    bind-key K confirm kill-server
    # toggle statusbar
    bind-key b set-option status
    # ctrl+left/right cycles thru windows
    #bind-key -n C-right next
    #bind-key -n C-left prev
    #bind-key -n M-right next
    #bind-key -n M-left prev
    # open a man page in new window
    bind m command-prompt "split-window 'exec man %%'"
    # quick view of processes
    bind '~' split-window "exec htop"
    # scrollback buffer n lines
    set -g history-limit 5000
    # listen for activity on all windows
    set -g bell-action any
    set -g bell-on-alert on
    set -g visual-bell off
    # on-screen time for display-panes in ms
    set -g display-panes-time 4000
    # start window indexing at one instead of zero
    set -g base-index 1
    # disable wm window titles
    set -g set-titles off
    # disable auto renaming
    #setw -g automatic-rename on
    # border colours
    set -g pane-active-border-bg default
    #set -g pane-border-fg blue
    # wm window title string (uses statusbar variables)
    set -g set-titles-string "tmux:#I [ #W ]"
    #set -g set-titles-string "tmux"
    # session initialization
    #new -s0 -nTTYtter 'ttytter'
    #neww -t0:1 -nvifm 'vifm'
    #selectw -t 1
    ### default statusbar colors
    set -g status-fg white
    set -g status-bg default
    set -g status-attr bright
    ### White Yunzi - statusbar
    set -g status-interval 1
    set -g status-justify centre # center align window list
    set -g status-left-length 30
    set -g status-left '#[fg=white,bright] [ #[fg=green,bright]#H#[fg=white,bright] ]#[fg=white] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
    set -g status-right-length 30
    set -g status-right '#[fg=green,bright][#[fg=white,bright] %a %m-%d-%Y %H:%M #[fg=green,bright]]'
    ### Silver Yunzi - statusbar
    # set -g status-interval 1
    # set -g status-justify centre # center align window list
    # set -g status-left-length 30
    # set -g status-left '#[fg=white,bright][ #[fg=blue,bright]#H#[fg=white,bright] ]#[fg=white] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
    # set-option -g status-right '#[fg=yellow]%k:%M #[fg=blue]%a,%d-%b#[default] '
    # set -g status-right-length 30
    # set -g status-right '#[fg=blue,bright][#[fg=white,bright] %a %b-%d-%Y %H:%M #[fg=blue,bright]]'
    # set-option -g status-right '#[fg=yellow]%a:%M #[fg=blue]%a,%d-%b#[default] '
    ### Pink Yunzi - statusbar
    # set -g status-interval 1
    # set -g status-justify centre # center align window list
    # set -g status-left-length 30
    # set -g status-left '#[fg=white,bright] [ #[fg=magenta,bright]#H#[fg=white,bright] ]#[fg=white] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
    # set -g status-right-length 30
    # set -g status-right '#[fg=magenta,bright][#[fg=white,dim] %a %m-%d-%Y %H:%M #[fg=magenta,bright]]'
    ### White Yunzi - active window title colors
    set-window-option -g window-status-current-fg green
    set-window-option -g window-status-current-attr bright
    set-window-option -g window-status-current-bg black
    set-window-option -g window-status-current-attr bright
    ### Silver Yunzi - active window title colors
    # set-window-option -g window-status-current-fg blue
    # set-window-option -g window-status-current-attr bright
    # set-window-option -g window-status-current-bg default
    # set-window-option -g window-status-current-attr bright
    ### Pink Yunzi - active window title colors
    # set-window-option -g window-status-current-fg magenta
    # set-window-option -g window-status-current-attr bright
    # set-window-option -g window-status-current-bg black
    # set-window-option -g window-status-current-attr bright
    ### default window title colors
    # set-window-option -g window-status-fg white
    # set-window-option -g window-status-bg default
    # set-window-option -g window-status-attr bright
    ### Silver Yunzi - command/message line colors
    set -g message-fg white
    set -g message-bg black
    set -g message-attr bright
    # show some useful stats but only when tmux is started
    # outside of Xorg, otherwise dwm statusbar shows these already
    #set -g status-right ""
    #set -g status-left ""
    #if '[ -z "$DISPLAY" ]' 'set -g status-left "[#[fg=green] #H #[default]]"'
    #if '[ -z "$DISPLAY" ]' 'set -g status-right "[ #[fg=magenta]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default] ][ #[fg=cyan,bright]%a %Y-%m-%d %H:%M #[default]]"'
    #if '[ -z "$DISPLAY" ]' 'set -g status-right-length 50'
    Insights appreciated! 

    No--
    In the Motion tab... right click the video in the sequence and send to viewer...
    Then under the MOTION tab... twirl down the DISTORT triangle and then check the aspect ratio there... set either to 0, 33 or -33.
    Good luck,
    CaptM

  • Some graphics in a website cannot be scrolled, panned or zoomed in/out

    http://professional.wsj.com/article/SB10001424053111903520204576480123949521268.html?mod=WSJ_Home_la...
    the graphics in the above website does not respond to scrolling, panning or zooming gestures. Is there a way to make it happen? without that, major parts of the graphics cannot be viewed.
    unfortunately this is a paid site so you may not be able to load it but i thought may be some of you may be subscribers.
    thanks.
    Solved!
    Go to Solution.

    thanks, aandras.
    in this art there is an interactive graphic which you can access either by 1) clicking on the graphic towards the middle of the article on the left side just above the picture of senator Reid, or 2) clicking on the tab near the start of the article labelled "interactive graphics".
    for me, either way will load that page but the page is not scrollable, zoomable nor pannable. that page actually has a set of 10 different graphics you can select via buttons in the left. oddly these buttons work and actually switch the graphics. but most of them are too large to be displayed on the playbook screen which therefore have to be scrolled/panned but that does not work for me. the page, other thank those buttons, acts as if it is frozen.

  • Scroll pane can't align it's content

    When a Node(group fro example) is added into a scroll pane, the scroll pane automatically align the node to the upper left corner of the scroll pane's content area. How can i customize the Node's alignment(the middle center eg) in the scroll pane. When the Node's size is scaled and larger than the scroll pane's size the scroll pane's scroll bar appears, and if the Node's size shrinks and it's size becomes smaller than the scroll pane's then the Node is aligned to the middle center. it seems don't take affect if i override the scroll pane's layoutChildren method and set layoutX and layoutY property of the Node.
    If any one can give me some clue?
    thanks

    ScrollPanes are somewhat tricky to use. They don't align content, you need to use layout managers to do that or you need to layout yourself with shapes in groups using absolute co-ordinates and/or translations. The ScrollPane defines it's own viewport related coordinates and you need to layout your content within that viewport.
    How can i customize the Node's alignment(the middle center eg) in the scroll pane.Get the layoutBoundsInParent of the node, get the viewportBounds of the scrollpane and perform the translation of the node such that the center of the node is in the center of the viewportBounds (will require a little bit of basic maths to do this) by adding listeners on each property.
    When the Node's size is scaled and larger than the scroll pane's size the scroll pane's scroll bar appears, and if the Node's size shrinks and it's size becomes smaller than the scroll pane's then the Node is aligned to the middle center.Similar to above, just work with those properties.
    Not exactly a direct answer to your question, but you could try playing around with the following code if you like Saludon. It is something I wrote to learn about JavaFX's layoutbounds system. Resizing the scene and toggling items on and off will allow you to see the scroll pane. The view bounds listeners show you the properties you are interested in to achieve the effect you want.
    import javafx.application.Application;
    import javafx.beans.value.*;
    import javafx.event.*;
    import javafx.geometry.Bounds;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.*;
    import javafx.scene.effect.DropShadow;
    import javafx.scene.layout.*;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.*;
    import javafx.stage.Stage;
    public class LayoutBoundsScrollableAnchorPane extends Application  {
      // define some controls.
      final ToggleButton stroke    = new ToggleButton("Add Border");
      final ToggleButton effect    = new ToggleButton("Add Effect");
      final ToggleButton translate = new ToggleButton("Translate");
      final ToggleButton rotate    = new ToggleButton("Rotate");
      final ToggleButton scale     = new ToggleButton("Scale");
      public static void main(String[] args) { launch(args); }
      @Override public void start(Stage stage) throws Exception {
        // create a square to be acted on by the controls.
        final Rectangle square = new Rectangle(20, 30, 100, 100); //square.setFill(Color.DARKGREEN);
        square.setStyle("-fx-fill: linear-gradient(to right, darkgreen, forestgreen)");
        // show the effect of a stroke.
        stroke.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent actionEvent) {
            if (stroke.isSelected()) {
              square.setStroke(Color.FIREBRICK); square.setStrokeWidth(10); square.setStrokeType(StrokeType.OUTSIDE);
            } else {
              square.setStroke(null); square.setStrokeWidth(0.0); square.setStrokeType(null);
            reportBounds(square);
        // show the effect of an effect.
        effect.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent actionEvent) {
            if (effect.isSelected()) {
              square.setEffect(new DropShadow());
            } else {
              square.setEffect(null);
            reportBounds(square);
        // show the effect of a translation.
        translate.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent actionEvent) {
            if (translate.isSelected()) {
              square.setTranslateX(100);
              square.setTranslateY(60);
            } else {
              square.setTranslateX(0);
              square.setTranslateY(0);
            reportBounds(square);
        // show the effect of a rotation.
        rotate.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent actionEvent) {
            if (rotate.isSelected()) {
              square.setRotate(45);
            } else {
              square.setRotate(0);
            reportBounds(square);
        // show the effect of a scale.
        scale.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent actionEvent) {
            if (scale.isSelected()) {
              square.setScaleX(2);
              square.setScaleY(2);
            } else {
              square.setScaleX(1);
              square.setScaleY(1);
            reportBounds(square);
        // layout the scene.
        final AnchorPane anchorPane = new AnchorPane();
        AnchorPane.setTopAnchor(square,  0.0);
        AnchorPane.setLeftAnchor(square, 0.0);
        anchorPane.setStyle("-fx-background-color: cornsilk;");
        anchorPane.getChildren().add(square);
        // add a scrollpane and size it's content to fit the pane (if it can).
        final ScrollPane scrollPane = new ScrollPane();
        scrollPane.setContent(anchorPane);
        square.boundsInParentProperty().addListener(new ChangeListener<Bounds>() {
          @Override public void changed(ObservableValue<? extends Bounds> observableValue, Bounds oldBounds, Bounds newBounds) {
            anchorPane.setPrefSize(Math.max(newBounds.getMaxX(), scrollPane.getViewportBounds().getWidth()), Math.max(newBounds.getMaxY(), scrollPane.getViewportBounds().getHeight()));
        scrollPane.viewportBoundsProperty().addListener(
          new ChangeListener<Bounds>() {
          @Override public void changed(ObservableValue<? extends Bounds> observableValue, Bounds oldBounds, Bounds newBounds) {
            anchorPane.setPrefSize(Math.max(square.getBoundsInParent().getMaxX(), newBounds.getWidth()), Math.max(square.getBoundsInParent().getMaxY(), newBounds.getHeight()));
        // layout the scene.
        VBox controlPane = new VBox(10);
        controlPane.setStyle("-fx-background-color: linear-gradient(to bottom, gainsboro, silver); -fx-padding: 10;");
        controlPane.getChildren().addAll(
          HBoxBuilder.create().spacing(10).children(stroke, effect).build(),
          HBoxBuilder.create().spacing(10).fillHeight(false).children(translate, rotate, scale).build()
        VBox layout = new VBox();
        VBox.setVgrow(scrollPane, Priority.ALWAYS);
        layout.getChildren().addAll(scrollPane, controlPane);
        // show the scene.
        final Scene scene = new Scene(layout, 300, 300);
        stage.setScene(scene);
        stage.show();
        reportBounds(square);
      /** output the squares bounds. */
      private void reportBounds(final Node n) {
        StringBuilder description = new StringBuilder();
        if (stroke.isSelected())       description.append("Stroke 10 : ");
        if (effect.isSelected())       description.append("Dropshadow Effect : ");
        if (translate.isSelected())    description.append("Translated 100, 60 : ");
        if (rotate.isSelected())       description.append("Rotated 45 degrees : ");
        if (scale.isSelected())        description.append("Scale 2 : ");
        if (description.length() == 0) description.append("Unchanged : ");
        System.out.println(description.toString());
        System.out.println("Layout Bounds:    " + n.getLayoutBounds());
        System.out.println("Bounds In Local:  " + n.getBoundsInLocal());
        System.out.println("Bounds In Parent: " + n.getBoundsInParent());
        System.out.println();
    }

Maybe you are looking for

  • Drag and Drop Error

    When I try to drag and drop folders in SharePoint 2013, I get a message 'We can't upload folders or empty files' but I can drag and drop the individual files.

  • Last approver of purchase requisition linked to workflow

    Hi Guys, Im writting a report to display retrospectively the usernames of the last approvers of a company's purchase requisitions for auditing purposes. After searching the forum I found a way to do this: 1) use SAP_WAPI_WORKITEMS_TO_OBJECT to retrie

  • How to order by criteria?

    Hello! Im currently trying to sort rows from a table based on String-criteria. the row "factor" contains "Critical", "Normal", and "Non-critical". How can i sort the rows so that all rows labeled 'Critical' is on top, then "Normal", then "Non-critita

  • How kann I store a very big file in to Oracle XML DB?

    Hello, I´m looking for a fast method to store a XML file in to a oracle 10g XE. I had try to store the 500 kb file in to the database as a xmltype or a clob, but I still have the same Error: "ORA-01704: string literal too long". I´m looking for a lon

  • Safari opens by itself at login

    Hi all, it's a few days that Safari started opening at login, before any other application, even before seeing the menubar. Furthermore, it's unresponsive so I have to force quit it. I've tried deleting the safari prefs with no avail. Found this in t