Witam, program pokazuje mi w ostatniej linijce wykrzyknik i pisze: reached end of file while Parsing. Jest to ostatni błąd, którego nie udało mi się wyeliminować. Proszę o pomoc, oto kod programu:
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
public class NewJInternalFrame extends javax.swing.JInternalFrame {
private Rectangle screenrect;
private JButton jButton1;
private JLabel jLabel1;
public NewJInternalFrame() {
initComponents();
}
private void initComponents() {
jButton1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jButton1.setText("Screenshot");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(154, 154, 154)
.addComponent(jButton1)
.addContainerGap(153, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try{
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage capture = new Robot().createScreenCapture(screenRect);
ImageIcon icon=new ImageIcon(capture);
jLabel1.setIcon(icon);
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable(){
@Override
public void run() {
new NewJInternalFrame().setVisible(true);
}
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
}
wiedzy i znajomości
lecz papierku:P ups ale chyba nie zawsze... przecież obecnieMc
potrzebują wykształconych:)