cellrenderer

How to limit number of decimal places to be displayed in Gtk CellRendererText

前提是你 提交于 2019-12-09 23:14:14
问题 I am trying to limit the amount of decimal places shown in a Gtk.CellRendererText. Currently a float number field is shown with 6 decimal places, but I would like to have just 1. This test code should work on Linux: #!/usr/bin/python3 from gi.repository import Gtk class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Hello World") self.set_default_size(200, 200) self.liststore = Gtk.ListStore(float) treeview = Gtk.TreeView(model=self.liststore) self.liststore.append

How to make the jList selectable inside a jTable

不打扰是莪最后的温柔 提交于 2019-12-08 03:41:52
问题 How to make the jList selectable and jScrollPane scrollable inside a jTable. This is my table code : private JTable getCalendarTable() { if (calendarTable == null) { calendarTable = new JTable() { public boolean isCellEditable(int nRow, int nCol) { if (nRow % 2 != 0) { return true; } else return false; } }; DefaultTableModel mtblCalendar = (DefaultTableModel) calendarTable .getModel(); String[] headers = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; for (int i = 0; i < 7; i++) {

JavaFX custom listView

空扰寡人 提交于 2019-12-06 15:58:43
问题 I wanted to ask the best way to make a ListView with custom objects in JavaFX, I want a list that each item looks like this: I searched and found that most people do it with the cell factory method. Is ther any other way? For example with a custome fxml? Here's my fmxl archive <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.ListView?> <?import javafx.scene.control.Menu?> <?import javafx.scene.control.MenuBar?> <?import javafx.scene.control.MenuItem?> <?import javafx.scene

AS3 disable editable/selectable for textInput inside of a Datagrid

不想你离开。 提交于 2019-12-05 08:10:38
I am currently trying to disable the selectable / editable / or change the textInput to dynamic to get my desired result. I've got a custom datagrid with dropdowns and text input areas. However, if there is no data in my Model # column, I do not want to allow for any entry in the corresponding PurchasePrice cell. col1 = new DataGridColumn("Model"); col1.headerText = "Model #"; c2.consumables_dg.addColumn(col1); col1.width = 60; col1.editable = false; col1.sortable = false; col1.cellRenderer = AlternatingRowColors_editNum_PurchasePrice; col1 = new DataGridColumn("PurchasePrice"); col1

How to limit number of decimal places to be displayed in Gtk CellRendererText

余生长醉 提交于 2019-12-04 19:21:27
I am trying to limit the amount of decimal places shown in a Gtk.CellRendererText. Currently a float number field is shown with 6 decimal places, but I would like to have just 1. This test code should work on Linux: #!/usr/bin/python3 from gi.repository import Gtk class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Hello World") self.set_default_size(200, 200) self.liststore = Gtk.ListStore(float) treeview = Gtk.TreeView(model=self.liststore) self.liststore.append([9.9]) self.liststore.append([1]) xrenderer = Gtk.CellRendererText() xrenderer.set_property("editable"

Why do cell renderers often extend JLabel?

余生长醉 提交于 2019-12-04 03:44:58
I noticed this is common. For example DefaultListCellRenderer, DefaultTableCellRenderer, and DefaultTreeCellRenderer all use it. Also a lot of the custom cell renderers I see online use this as well. I want to use a custom TableCellRenderer in my code, but I'm confused about whether I really need to subclass JLabel. What's the benefit of subclassing JLabel? camickr The API for the DefaultTableCellRenderer states: The table class defines a single cell renderer and uses it as a as a rubber-stamp for rendering all cells in the table; it renders the first cell, changes the contents of that cell

JTable change cell colors using TableCellRenderer

为君一笑 提交于 2019-11-29 16:37:07
I am using a JTable in my GUI application as a grid to represent positions for a game. I want the cells of the table that represent a certain position of an object to have a certain color, and on some actions, the object to move (i.e the color cell to move around in the Grid /JTable). I know that I can change cell colors by making a class that extends DefaultTableCellRenderer , is this the only way it can be done? or is there a simpler way to chage cell colors??Also Is JXTable better than JTable for such an application ? EDIT: I didn't include the fact that I need certain cell colors to change

Custom TableCellRenderer not working (table row rendering)

女生的网名这么多〃 提交于 2019-11-29 15:51:11
I'm trying to render an specific row of my jtable (it should have a different background color and it should have bold characters). I found several questions regarding how to implement a custom TableCellRenderer ( here and here ) and the tutorial How to Use Tables and this one ( Table Row Rendering ). I'm using a JInternalFrame to display the JTable . I tried to implement both solutions but neither getCellRenderer nor prepareRenderer are being called. When debugging, I can see my new jtable being created, but, my breakpoint inside the methods aren't called. My code looks like: this.add

Trying to color specific cell in JTable… getTableCellRendererComponent Overide

青春壹個敷衍的年華 提交于 2019-11-29 08:46:27
So I know this may be a duplicate question, but I've looked through many of the ones already on here and none of them seem to work for me, so I thought I would post my own and hopefully some of the other people having trouble with this will find this helpful also. Here is my code table.getColumn("Name").setCellRenderer( new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { setText(value.toString()); if (row==3) { setForeground(Color.RED); } return this; } } ); Here is

JTable change cell colors using TableCellRenderer

北城余情 提交于 2019-11-28 10:39:02
问题 I am using a JTable in my GUI application as a grid to represent positions for a game. I want the cells of the table that represent a certain position of an object to have a certain color, and on some actions, the object to move (i.e the color cell to move around in the Grid /JTable). I know that I can change cell colors by making a class that extends DefaultTableCellRenderer , is this the only way it can be done? or is there a simpler way to chage cell colors??Also Is JXTable better than