У меня есть фрейм, расширяющийся от JWindow
(потому что я хочу обрабатывать свои кнопки X и - ), поэтому я не хочу, чтобы он украшался. Моя проблема в том, что когда я запускаю приложение, я не могу перетащить свое окно - оно зафиксировано в определенном месте. Мой код выглядит следующим образом (класс i большой, поэтому я выбрал соответствующий раздел):
открытый класс StatisticsMainFrame extends JWindow{
public StatisticsMainFrame()
{
bodyPane = new JPanel();
bodyPane.setLayout(new BoxLayout(bodyPane, BoxLayout.X_AXIS));
sideBannerPane = new JPanel(); // program banner
buttonsPane = new JPanel(); // contains buttons
contentPane = new JPanel();
contentPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
contentPane.setPreferredSize(new Dimension(500,500));
// contentPane contains some panel for display data
Container container = new Container();
container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
container.add(Box.createVerticalGlue());
container.add(sideBannerPane);
container.add(buttonsPane);
container.add(contentPane);
Container cont = new Container();
cont.setLayout(new BoxLayout(cont, BoxLayout.Y_AXIS));
//cont.add(Box.createHorizontalGlue());
//cont.add(custDecorationPane);
cont.add(container);
add(cont);
// Adding Panes
setAlwaysOnTop(true);
//setUndecorated(true);
pack();
}
public static void main(String[] arg)
{
new StatisticsMainFrame().setVisible(true);
}
private CustomFrameDecorationButtons custDecorationPane;
private JPanel bodyPane;
private JPanel contentPane;
private JPanel sideBannerPane;
private JPanel buttonsPane;
// buttonsPane components
private JLabel general_lbl;
private JLabel Diagnosis_lbl;
private JLabel chemotherapy_lbl;
private JLabel radiotherapy_lbl;
private JLabel surgery_lbl;
private JLabel hermonalTherapy_lbl;
private RootButton generalStatistics_btn;
private RootButton statOfAffectedSys_btn;
private RootButton statOfGrade_btn;
private RootButton statOfCombinations_btn;
private RootButton statOfResponses_btn;
private RootButton statOfRadiotherapy_btn;
private RootButton statOfSurgery_btn;
private RootButton statOfHermonaltherapy_btn;
private GeneralStatisticsContentPanel generalStatPane;
private StatisticsOfAffectedSystemPanel2 statOfAffectedSysPanel2;
private StatisticsOfGradePanel statOFGradingPanel;
private ChemotherapyCombinationStatisticsPanel statChemotherapyCombinationPanel;
private ChemotherapyResponseStatisticsPanel statChemotherapyResponsePanel;
private RadiotherapyStatisticsPanel radiotherapyPanel;
private SurgeryStatisticsPanel surgeryStatPanel;
private HermonaltherapyStatisticsPanel hermonaltherapy;
}