jbutton

Making button in JList clickable

岁酱吖の 提交于 2020-07-03 06:09:29
问题 I can't believe this does not work. I have a JList. I have set its renderer as follows. Basically RankingPanel is a JPanel with two labels and a button. topAchieverList = new JList(); topAchieverList.setCellRenderer(new TopBottomCellRenderer()); Here is my TopBottomCellRenderer. class TopBottomCellRenderer extends RankingPanel implements ListCellRenderer { public TopBottomCellRenderer() { } public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,

Container not displaying in JScrollPane

大兔子大兔子 提交于 2020-06-29 03:42:17
问题 I have a JScrollPane that will fill up with buttons added by the user. Currently, the user creates a new button and it is added to the container that is inside the scroll pane but nothing is displayed. Is this because the scroll pane has already been displayed? Initiating the scroll pane and container: newHeading.addActionListener(this); newHeading.setActionCommand("newHeading"); contractContainer.setLayout(new BoxLayout(contractContainer, BoxLayout.Y_AXIS)); scrollPane

Container not displaying in JScrollPane

馋奶兔 提交于 2020-06-29 03:41:34
问题 I have a JScrollPane that will fill up with buttons added by the user. Currently, the user creates a new button and it is added to the container that is inside the scroll pane but nothing is displayed. Is this because the scroll pane has already been displayed? Initiating the scroll pane and container: newHeading.addActionListener(this); newHeading.setActionCommand("newHeading"); contractContainer.setLayout(new BoxLayout(contractContainer, BoxLayout.Y_AXIS)); scrollPane