Changeset 627


Ignore:
Timestamp:
12/16/13 16:14:07 (10 years ago)
Author:
jts21
Message:

Add error message if JfxBrowser fails to load.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/JfxBrowser.java

    r621 r627  
    44import java.awt.Color;
    55import java.awt.Component;
     6import java.awt.Font;
    67import java.awt.Point;
    78import java.awt.event.ActionEvent;
     
    1920
    2021import javax.swing.JButton;
     22import javax.swing.JLabel;
    2123import javax.swing.JPanel;
    2224import javax.swing.JTextField;
    2325import javax.swing.JToolBar;
     26import javax.swing.SwingConstants;
    2427import javax.swing.text.BadLocationException;
    2528
     
    245248                                this.add((Component) jfxPanel);
    246249
    247                                 // Setting bg color to be the same as bg color of widgets when they're being dragged/resized
    248                                 this.setBackground(new Color(100, 100, 100));
    249 
    250250                                JavaFX.PlatformRunLater.invoke(null, new Runnable() {
    251251                                        @Override
     
    256256                        } catch (Exception e) {
    257257                                e.printStackTrace();
    258                         }
     258                                // if this occurs JavaFX was probably missing
     259                                this.removeAll();
     260                                JLabel label = new JLabel("<html><p style=\"text-align: center;\">Failed to load<br/>Most likely JavaFX could not be found<br/>Make sure you are running at least Java 7<br/>(Preferably Java 8)</p></html>");
     261                                label.setHorizontalAlignment(SwingConstants.CENTER);
     262                                label.setForeground(Color.RED);
     263                                label.setFont(new Font("sans-serif", 0, 20));
     264                                this.add(label);
     265                        }
     266                       
     267                        // Setting bg color to be the same as bg color of widgets when they're being dragged/resized
     268                        this.setBackground(new Color(100, 100, 100));
    259269                }
    260270
Note: See TracChangeset for help on using the changeset viewer.