()
| 111 | private VideoFrame main; |
| 112 | |
| 113 | @SuppressWarnings("unused") |
| 114 | public Test_Video() { |
| 115 | main = new VideoFrame(); |
| 116 | main.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
| 117 | main.setTransferHandler(new FileDropHandler(main)); |
| 118 | |
| 119 | boolean testRemote = false;// setting this true requires Java 9 |
| 120 | isDiscrete = true; |
| 121 | |
| 122 | String video = ( |
| 123 | // "test/jmoljana_960x540.png"); |
| 124 | // fails"test/EnergyTransfer.mp4" |
| 125 | // "test/jmoljana.mp4", |
| 126 | "test/duet.mp4"); |
| 127 | |
| 128 | URL videoURL = null; |
| 129 | if (testRemote) |
| 130 | try { |
| 131 | videoURL = new URL("https://chemapps.stolaf.edu/test/duet.mp4"); |
| 132 | } catch (MalformedURLException e1) { |
| 133 | } |
| 134 | vw = 1920; |
| 135 | vh = vw * 9 / 16; |
| 136 | w = 1920 / 4; |
| 137 | h = w * 9 / 16; |
| 138 | Dimension dim = new Dimension(w, w * 9 / 16); |
| 139 | |
| 140 | imageLabel = new JLabel(); |
| 141 | imageLabel.setAlignmentX(0.5f); |
| 142 | int type = (isJS ? JSUtilI.TYPE_4BYTE_HTML5 : BufferedImage.TYPE_4BYTE_ABGR); |
| 143 | image = new BufferedImage(w, h, type); |
| 144 | ImageIcon imageicon = new ImageIcon(image); |
| 145 | imageLabel.setIcon(imageicon); |
| 146 | File file = new File(video); |
| 147 | |
| 148 | createVideoLabel(file, videoURL, video); |
| 149 | // A little trick to allow "final" self reference in a Runnable parameter |
| 150 | |
| 151 | createDialog(); |
| 152 | |
| 153 | // dialog[0].setOpaque(true); |
| 154 | |
| 155 | Container cp = main.getContentPane(); |
| 156 | cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS)); |
| 157 | JPanel videoPanel = getLayerPane(dim); |
| 158 | cp.add(videoPanel); |
| 159 | videoPanel.setAlignmentX(0.5f); |
| 160 | JPanel controls = getControls(); |
| 161 | controls.setAlignmentX(0.5f); |
| 162 | cp.add(controls); |
| 163 | cp.add(imageLabel); |
| 164 | main.pack(); |
| 165 | main.setVisible(true); |
| 166 | |
| 167 | // main.setBackground(Color.orange); |
| 168 | // main.getRootPane().setOpaque(true); |
| 169 | // System.out.println(main.isOpaque() + " " + Integer.toHexString(main.getBackground().getRGB())); |
| 170 | // cp.setBackground(Color.red); |
nothing calls this directly
no test coverage detected