com.alee.laf.table.WebTable Java Examples
The following examples show how to use
com.alee.laf.table.WebTable.
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: RowNumberTable.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public Component getTableCellRendererComponent( WebTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (table != null) { WebTableHeader header = (WebTableHeader) table.getTableHeader(); if (header != null) { setForeground(header.getForeground()); setBackground(header.getBackground()); setFont(header.getFont()); } } if (isSelected) { //setFont( getFont().deriveFont(Font.BOLD) ); } setText((value == null) ? "" : value.toString()); setBorder(UIManager.getBorder("TableHeader.cellBorder")); return this; }
Example #2
Source File: EmergencySupplyMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Constructor. */ public EmergencySupplyMissionCustomInfoPanel() { // Use JPanel constructor super(); // Set the layout. setLayout(new BorderLayout()); // Create the emergency supplies label. WebLabel emergencySuppliesLabel = new WebLabel(Msg.getString("EmergencySupplyMissionCustomInfoPanel.emergencySupplies"), WebLabel.LEFT); //$NON-NLS-1$ add(emergencySuppliesLabel, BorderLayout.NORTH); // Create a scroll pane for the emergency supplies table. WebScrollPane emergencySuppliesScrollPane = new WebScrollPane(); emergencySuppliesScrollPane.setPreferredSize(new Dimension(-1, -1)); add(emergencySuppliesScrollPane, BorderLayout.CENTER); // Create the emergency supplies table and model. emergencySuppliesTableModel = new EmergencySuppliesTableModel(); WebTable emergencySuppliesTable = new WebTable(emergencySuppliesTableModel); emergencySuppliesScrollPane.setViewportView(emergencySuppliesTable); }
Example #3
Source File: AboutLibraryDialog.java From weblaf with GNU General Public License v3.0 | 6 votes |
/** * Returns properties tab content. * * @return properties tab content */ @NotNull private Component createPropertiesTab () { final Object[][] systemPropertiesData = createSystemPropertiesData (); final String key = LM.get ( "weblaf.about.dialog.properties.key" ); final String value = LM.get ( "weblaf.about.dialog.properties.value" ); final String[] colums = { key, value }; final DefaultTableModel model = new DefaultTableModel ( systemPropertiesData, colums ); final WebTable propertiesTable = new WebTable ( StyleId.tableTransparent, model ); propertiesTable.setPreferredScrollableViewportSize ( new Dimension ( 1, 1 ) ); propertiesTable.setEditable ( false ); return new WebScrollPane ( StyleId.scrollpaneTransparentHovering, propertiesTable ); }
Example #4
Source File: TranslationEditor.java From Cafebabe with GNU General Public License v3.0 | 4 votes |
public TranslationEditor() { super(Cafebabe.gui, true); this.setRound(5); this.setShadeWidth(20); this.setShowResizeCorner(false); this.initBounds(); this.setTitle(Translations.get("Translation editor")); this.setIconImage(Cafebabe.gui.getIconImage()); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); WebTable table = new WebTable() { private static final long serialVersionUID = 1L; @Override public boolean isCellEditable(int row, int column) { return column > 0; } }; DefaultTableModel model = new DefaultTableModel(new Object[] { "Hash code", "Translation" }, 0); for (int hashCode : Translations.translations.keySet()) { String translation = Translations.translations.get(hashCode); model.addRow(new Object[] { hashCode, translation }); } table.setColumnSelectionAllowed(false); table.getTableHeader().setReorderingAllowed(false); table.setModel(model); model.addTableModelListener(l -> { for (int row = 0; row < model.getRowCount(); row++) Translations.translations.put((Integer) model.getValueAt(row, 0), (String) model.getValueAt(row, 1)); Translations.saveTranslations(); }); JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); pane.add(new WebScrollPane(table), BorderLayout.CENTER); pane.add( new JLabel( "<html>Please open an issue on the official github-repo and send in your tranlations!<br>Translations are stored in <u>%userprofile%/.cafebabe/translations/</u><br>Make sure you don't miss out any translations.<br>Translations are added to the table when they were shown at least once!"), BorderLayout.NORTH); this.setContentPane(pane); setLocationRelativeTo(getParent()); this.setVisible(true); }
Example #5
Source File: MiningMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor * * @param desktop the main desktop. */ MiningMissionCustomInfoPanel(MainDesktopPane desktop) { // Use JPanel constructor super(); // Set the layout. setLayout(new BorderLayout()); // Initialize data members. this.desktop = desktop; // Create LUV panel. WebPanel luvPane = new WebPanel(new FlowLayout(FlowLayout.LEFT)); add(luvPane, BorderLayout.NORTH); // Create LUV label. WebLabel luvLabel = new WebLabel("Light Utility Vehicle: "); luvPane.add(luvLabel); // Create LUV button. luvButton = new WebButton(" "); luvButton.setVisible(false); luvButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Open window for light utility vehicle. LightUtilityVehicle luv = mission.getLightUtilityVehicle(); if (luv != null) getDesktop().openUnitWindow(luv, false); } }); luvPane.add(luvButton); // Create center panel. WebPanel centerPane = new WebPanel(new GridLayout(2, 1)); add(centerPane, BorderLayout.CENTER); // Create concentration panel. WebPanel concentrationPane = new WebPanel(new BorderLayout()); centerPane.add(concentrationPane); // Create concentration label. WebButton concentrationLabel = new WebButton("Mineral Concentrations at Site:"); concentrationPane.add(concentrationLabel, BorderLayout.NORTH); // Create concentration scroll panel. WebScrollPane concentrationScrollPane = new WebScrollPane(); concentrationScrollPane.setPreferredSize(new Dimension(-1, -1)); concentrationPane.add(concentrationScrollPane, BorderLayout.CENTER); // Create concentration table. concentrationTableModel = new ConcentrationTableModel(); WebTable concentrationTable = new WebTable(concentrationTableModel); concentrationTable.setDefaultRenderer(Double.class, new NumberCellRenderer(1)); concentrationScrollPane.setViewportView(concentrationTable); // Create excavation panel. WebPanel excavationPane = new WebPanel(new BorderLayout()); centerPane.add(excavationPane); // Create excavation label. WebLabel excavationLabel = new WebLabel("Minerals Excavated at Site:"); excavationPane.add(excavationLabel, BorderLayout.NORTH); // Create excavation scroll panel. WebScrollPane excavationScrollPane = new WebScrollPane(); excavationScrollPane.setPreferredSize(new Dimension(-1, -1)); excavationPane.add(excavationScrollPane, BorderLayout.CENTER); // Create excavation tabel. excavationTableModel = new ExcavationTableModel(); WebTable excavationTable = new WebTable(excavationTableModel); excavationTable.setDefaultRenderer(Double.class, new NumberCellRenderer(2)); excavationScrollPane.setViewportView(excavationTable); }
Example #6
Source File: TradeMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. */ public TradeMissionCustomInfoPanel() { // Use JPanel constructor super(); // Set the layout. setLayout(new GridLayout(3, 1)); // Create the selling goods panel. WebPanel sellingGoodsPane = new WebPanel(new BorderLayout()); add(sellingGoodsPane); // Create the selling goods label. WebLabel sellingGoodsLabel = new WebLabel("Goods to Sell:", WebLabel.LEFT); sellingGoodsPane.add(sellingGoodsLabel, BorderLayout.NORTH); // Create a scroll pane for the selling goods table. WebScrollPane sellingGoodsScrollPane = new WebScrollPane(); sellingGoodsScrollPane.setPreferredSize(new Dimension(-1, -1)); sellingGoodsPane.add(sellingGoodsScrollPane, BorderLayout.CENTER); // Create the selling goods table and model. sellingGoodsTableModel = new SellingGoodsTableModel(); WebTable sellingGoodsTable = new WebTable(sellingGoodsTableModel); sellingGoodsScrollPane.setViewportView(sellingGoodsTable); // Create the desired goods panel. WebPanel desiredGoodsPane = new WebPanel(new BorderLayout()); add(desiredGoodsPane); // Create the desired goods label panel. WebPanel desiredGoodsLabelPane = new WebPanel(new GridLayout(1, 2, 0, 0)); desiredGoodsPane.add(desiredGoodsLabelPane, BorderLayout.NORTH); // Create the desired goods label. WebLabel desiredGoodsLabel = new WebLabel("Desired Goods to Buy:", WebLabel.LEFT); desiredGoodsLabelPane.add(desiredGoodsLabel); // Create the desired goods profit label. desiredGoodsProfitLabel = new WebLabel("Profit:", WebLabel.LEFT); desiredGoodsLabelPane.add(desiredGoodsProfitLabel); // Create a scroll pane for the desired goods table. WebScrollPane desiredGoodsScrollPane = new WebScrollPane(); desiredGoodsScrollPane.setPreferredSize(new Dimension(-1, -1)); desiredGoodsPane.add(desiredGoodsScrollPane, BorderLayout.CENTER); // Create the desired goods table and model. desiredGoodsTableModel = new DesiredGoodsTableModel(); WebTable desiredGoodsTable = new WebTable(desiredGoodsTableModel); desiredGoodsScrollPane.setViewportView(desiredGoodsTable); // Create the bought goods panel. WebPanel boughtGoodsPane = new WebPanel(new BorderLayout()); add(boughtGoodsPane); // Create the bought goods label panel. WebPanel boughtGoodsLabelPane = new WebPanel(new GridLayout(1, 2, 0, 0)); boughtGoodsPane.add(boughtGoodsLabelPane, BorderLayout.NORTH); // Create the bought goods label. WebLabel boughtGoodsLabel = new WebLabel("Goods Bought:", WebLabel.LEFT); boughtGoodsLabelPane.add(boughtGoodsLabel); // Create the bought goods profit label. boughtGoodsProfitLabel = new WebLabel("Profit:", WebLabel.LEFT); boughtGoodsLabelPane.add(boughtGoodsProfitLabel); // Create a scroll pane for the bought goods table. WebScrollPane boughtGoodsScrollPane = new WebScrollPane(); boughtGoodsScrollPane.setPreferredSize(new Dimension(-1, -1)); boughtGoodsPane.add(boughtGoodsScrollPane, BorderLayout.CENTER); // Create the bought goods table and model. boughtGoodsTableModel = new BoughtGoodsTableModel(); WebTable boughtGoodsTable = new WebTable(boughtGoodsTableModel); boughtGoodsScrollPane.setViewportView(boughtGoodsTable); }
Example #7
Source File: ConstructionMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param desktop the main desktop panel. */ public ConstructionMissionCustomInfoPanel(MainDesktopPane desktop) { // Use MissionCustomInfoPanel constructor. super(); // Initialize data members. this.desktop = desktop; // Set layout. setLayout(new BorderLayout()); WebPanel contentsPanel = new WebPanel(new GridLayout(4, 1)); add(contentsPanel, BorderLayout.NORTH); WebPanel titlePanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); contentsPanel.add(titlePanel); String titleLabelString = Msg.getString("ConstructionMissionCustomInfoPanel.titleLabel"); //$NON-NLS-1$ WebLabel titleLabel = new WebLabel(titleLabelString); titlePanel.add(titleLabel); WebPanel settlementPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentsPanel.add(settlementPanel); String settlementLabelString = Msg.getString("ConstructionMissionCustomInfoPanel.settlementLabel"); //$NON-NLS-1$ WebLabel settlementLabel = new WebLabel(settlementLabelString); settlementPanel.add(settlementLabel); settlementButton = new WebButton(" "); settlementPanel.add(settlementButton); settlementButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (mission != null) { Settlement settlement = mission.getAssociatedSettlement(); if (settlement != null) getDesktop().openUnitWindow(settlement, false); } } }); WebPanel stagePanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentsPanel.add(stagePanel); String stageLabelString = Msg.getString("ConstructionMissionCustomInfoPanel.stageLabel"); //$NON-NLS-1$ stageLabel = new WebLabel(stageLabelString); stagePanel.add(stageLabel); WebPanel progressBarPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentsPanel.add(progressBarPanel); WebProgressBar progressBar = new WebProgressBar(); progressBarModel = progressBar.getModel(); progressBar.setStringPainted(true); progressBarPanel.add(progressBar); WebPanel lowerContentsPanel = new WebPanel(new BorderLayout(0, 0)); add(lowerContentsPanel, BorderLayout.CENTER); // Create remaining construction materials label panel. WebPanel remainingMaterialsLabelPane = new WebPanel(new FlowLayout(FlowLayout.LEFT)); lowerContentsPanel.add(remainingMaterialsLabelPane, BorderLayout.NORTH); // Create remaining construction materials label. String remainingMaterialsLabelString = Msg.getString("ConstructionMissionCustomInfoPanel.remainingMaterialsLabel"); //$NON-NLS-1$ WebLabel remainingMaterialsLabel = new WebLabel(remainingMaterialsLabelString); remainingMaterialsLabelPane.add(remainingMaterialsLabel); // Create a scroll pane for the remaining construction materials table. WebScrollPane remainingMaterialsScrollPane = new WebScrollPane(); remainingMaterialsScrollPane.setPreferredSize(new Dimension(-1, -1)); lowerContentsPanel.add(remainingMaterialsScrollPane, BorderLayout.CENTER); // Create the remaining construction materials table and model. remainingMaterialsTableModel = new RemainingMaterialsTableModel(); WebTable remainingMaterialsTable = new WebTable(remainingMaterialsTableModel); remainingMaterialsScrollPane.setViewportView(remainingMaterialsTable); // Add tooltip. setToolTipText(getToolTipString()); }
Example #8
Source File: MainFrame.java From desktopclient-java with GNU General Public License v3.0 | 4 votes |
private static WebPanel createListPanel(final WebTable list, String overlayText, WebToggleButton button) { // overlay for empty list WebOverlay listOverlay = new WebOverlay(list); listOverlay.setOverlayMargin(20); final WebTextArea overlayArea = new WebTextArea(); overlayArea.setText(overlayText); overlayArea.setLineWrap(true); overlayArea.setWrapStyleWord(true); overlayArea.setMargin(View.MARGIN_DEFAULT); overlayArea.setFontSize(View.FONT_SIZE_BIG); overlayArea.setEditable(false); BorderPainter<WebTextArea> borderPainter = new BorderPainter<>(Color.LIGHT_GRAY); borderPainter.setRound(15); overlayArea.setPainter(borderPainter); list.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { overlayArea.setVisible(list.getModel().getRowCount() == 0); } }); overlayArea.setVisible(list.getModel().getRowCount() == 0); listOverlay.addOverlay(overlayArea, SwingConstants.CENTER, SwingConstants.CENTER); WebScrollPane scrollPane = new ComponentUtils.ScrollPane(listOverlay); scrollPane.setDrawBorder(false); // button as overlay button.setOpaque(false); button.setUndecorated(true); WebOverlay chatListOverlay = new WebOverlay(scrollPane, button, SwingConstants.TRAILING, SwingConstants.BOTTOM); chatListOverlay.setOverlayMargin(0, 0, View.GAP_BIG, View.GAP_BIG + SCROLL_BAR_WIDTH); // fixing overlay button paint bug on startup, dont wanna know whats happening here SwingUtils.delayInvokeLater(0, new Runnable() { @Override public void run() { TooltipManager.showOneTimeTooltip(list, new Point(1,1), ""); } }); return chatListOverlay; }