Я немного новичок в Java и использую intellij для изучения графического интерфейса.Если я правильно понимаю, intellij не собирает исходный код для вашего графического интерфейса при разработке, вы должны выбрать build-> buildproject.Это автоматически генерирует код, но предоставляет вещи, которые дают мне ошибку в моем коде.Повсюду это отображается как «com.intellij.uiDesigner.core.GridConstraints», в редакторе он красный.
import javax.swing.*;
import java.awt.*;
public class GameGUI {
private JPanel contolPanel;
private JLabel labelImage;
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
contolPanel = new JPanel();
contolPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
contolPanel.setAlignmentX(1.0f);
contolPanel.setAlignmentY(1.0f);
contolPanel.setAutoscrolls(false);
contolPanel.putClientProperty("html.disable", Boolean.FALSE);
labelImage = new JLabel();
labelImage.setIcon(new ImageIcon(getClass().getResource("/images/java.png")));
labelImage.setText("Label");
contolPanel.add(labelImage, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer1 = new com.intellij.uiDesigner.core.Spacer();
contolPanel.add(spacer1, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contolPanel;
}
}