Java Code Examples for javax.swing.JList#setFont()
The following examples show how to use
javax.swing.JList#setFont() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JFrameList.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
private JList<Object> createList(List<Object> objs) { JList<Object> list = new JList<>(); list.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); DefaultListModel<Object> lm = new DefaultListModel<>(); for (Object o : objs) { if (o instanceof Integer) { lm.addElement(new IntType((int) o)); } else { lm.addElement(o); } } list.setModel(lm); return list; }
Example 2
Source File: GroupDeleterDialog.java From nanoleaf-desktop with MIT License | 4 votes |
private void initUI(Component parent) { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(474, 225); setLocationRelativeTo(parent); setUndecorated(true); JPanel contentPane = new JPanel(); contentPane.setBackground(Color.DARK_GRAY); contentPane.setBorder(new LineBorder(new Color(128, 128, 128), 2)); setContentPane(contentPane); contentPane.setLayout(new MigLayout("", "[255.00,grow][106.00,grow][grow]", "[][grow][]")); WindowDragListener wdl = new WindowDragListener(50); addMouseListener(wdl); addMouseMotionListener(wdl); JLabel lblTitle = new JLabel("Select a Group"); lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 22)); lblTitle.setForeground(Color.WHITE); contentPane.add(lblTitle, "gapx 15 0, cell 0 0"); CloseButton btnClose = new CloseButton(this, JFrame.DISPOSE_ON_CLOSE); contentPane.add(btnClose, "cell 2 0,alignx right,gapx 0 15"); JScrollPane devicesScrollPane = new JScrollPane(); devicesScrollPane.setBorder(null); devicesScrollPane.getHorizontalScrollBar().setUI(new ModernScrollBarUI()); devicesScrollPane.getVerticalScrollBar().setUI(new ModernScrollBarUI()); contentPane.add(devicesScrollPane, "cell 0 1 3 1,grow"); groupsModel = new DefaultListModel<String>(); JList<String> listGroups = new JList<String>(groupsModel); listGroups.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listGroups.setFont(new Font("Tahoma", Font.PLAIN, 20)); listGroups.setBackground(Color.DARK_GRAY); listGroups.setBorder(new LineBorder(Color.GRAY)); listGroups.setForeground(Color.WHITE); devicesScrollPane.setViewportView(listGroups); JButton btnCreateGroup = new ModernButton("Delete Group"); btnCreateGroup.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteGroup(listGroups.getSelectedValue()); } }); contentPane.add(btnCreateGroup, "cell 2 2"); }
Example 3
Source File: ReadLogsWindow.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 4 votes |
private JList<String> logFilesList() { file = new File(System.getProperty("user.dir") + File.separator + "Logging Store/"); final JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(file); fileChooser.setMultiSelectionEnabled(true); final DefaultListModel<String> model = new DefaultListModel<String>(); final JList<String> list = new JList<String>(model); list.setPreferredSize(new Dimension(85, 480)); list.setFont(new Font("Dialog", Font.PLAIN, 12)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); list.setFixedCellHeight(18); list.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2) { selectedItem = list.getSelectedValue(); getSelectedFileName(); } } }); list.setCellRenderer(new LogRecordsListRenderer()); File[] selectedFiles = fileChooser.getCurrentDirectory().listFiles(); for (File f : selectedFiles) { if (f.getName().indexOf(".log") != -1) { model.addElement(f.getName()); }else { continue; } } if(model.isEmpty()) { model.addElement("List is empty!"); } return list; }
Example 4
Source File: JListFactory.java From WorldGrower with GNU General Public License v3.0 | 4 votes |
private static<T> void setListProperties(JList<T> list) { list.setOpaque(false); list.setBackground(ColorPalette.DARK_BACKGROUND_COLOR); list.setForeground(ColorPalette.FOREGROUND_COLOR); list.setFont(Fonts.FONT); }
Example 5
Source File: KeywordsListPane.java From magarena with GNU General Public License v3.0 | 4 votes |
KeywordsListPane(final KeywordPanelB keywordPanel) throws IOException { JList<Keyword> list = new JList<>(KeywordsHelper.getKeywords()); list.setLayoutOrientation(JList.VERTICAL_WRAP); list.setVisibleRowCount(-1); list.setOpaque(false); list.setCellRenderer(new KeywordsListCellRenderer()); list.setForeground(Color.WHITE); list.setFont(list.getFont().deriveFont(14f)); list.addListSelectionListener((e) -> { final Keyword keyword = list.getSelectedValue(); keywordPanel.setKeyword(keyword); }); list.setSelectedIndex(0); setViewportView(list); setOpaque(false); getViewport().setOpaque(false); }
Example 6
Source File: YogaCombinationsView.java From Astrosoft with GNU General Public License v2.0 | 3 votes |
public YogaCombinationsView(String title, YogaResults yogaResults, PlanetaryInfo planetaryInfo) { super(viewSize, viewLoc); this.planetaryInfo = planetaryInfo; this.yogaResults = yogaResults; JPanel yogaPanel = new JPanel(); yogaList = new JList(yogaResults.getYogas().toArray()); yogaList.setFont(UIUtil.getFont("Tahoma", Font.PLAIN, 11)); yogaList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); yogaList.setSelectedIndex(0); yogaPanel.add(yogaList); yogaPanel.setPreferredSize(yogaSize); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, yogaPanel, createResultPane()); yogaPanel.setBorder(BorderFactory.createEtchedBorder()); splitPane.setBorder(BorderFactory.createEmptyBorder()); yogaList.addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { //splitPane.remove(chartPanel); yogaChanged((YogaResults.Result)yogaList.getSelectedValue()); //splitPane.add(chartPanel); } }); add(splitPane,BorderLayout.CENTER); }
Example 7
Source File: VargaChartView.java From Astrosoft with GNU General Public License v2.0 | 3 votes |
public VargaChartView(String title, PlanetaryInfo planetaryInfo) { super(title, viewSize); this.planetaryInfo = planetaryInfo; JPanel vargaPanel = new JPanel(); final JList vargaList = new JList(Varga.values()); vargaList.setFont(UIUtil.getFont("Tahoma", Font.PLAIN, 11)); vargaList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); vargaList.setSelectedIndex(0); vargaPanel.add(vargaList); vargaPanel.setPreferredSize(vargaSize); chartPanel = new JPanel(new BorderLayout()); chartPanel.add(new Chart(new PlanetChartData(Varga.Bhava, planetaryInfo), chartSize), BorderLayout.CENTER); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, vargaPanel, chartPanel); vargaPanel.setBorder(BorderFactory.createEtchedBorder()); splitPane.setBorder(BorderFactory.createEtchedBorder()); chartPanel.setBorder(BorderFactory.createEmptyBorder()); vargaList.addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { splitPane.remove(chartPanel); vargaChanged((Varga)vargaList.getSelectedValue()); splitPane.add(chartPanel); } }); add(splitPane,BorderLayout.CENTER); }