Compare commits
2 Commits
interactiv
...
guiSRAM
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43e79778fe | ||
|
|
7ef8a285e0 |
@@ -2,9 +2,11 @@ package de.darkress.pic16f84sim;
|
||||
|
||||
import de.darkress.pic16f84sim.commands.Command;
|
||||
import de.darkress.pic16f84sim.decoder.CommandDecoder;
|
||||
import de.darkress.pic16f84sim.gui.SramTable;
|
||||
import de.darkress.pic16f84sim.microcontroller.Memory;
|
||||
import de.darkress.pic16f84sim.microcontroller.ProgramCounter;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class Main
|
||||
@@ -19,5 +21,14 @@ class Main
|
||||
{
|
||||
program.get(ProgramCounter.getPc()).execute();
|
||||
}
|
||||
|
||||
SramTable table = new SramTable();
|
||||
JFrame frame = new JFrame("Table Example");
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.add(table.getTable());
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
//table.setValueAt("test", 15, 7);
|
||||
|
||||
}
|
||||
}
|
||||
52
de/darkress/pic16f84sim/gui/SramTable.java
Normal file
52
de/darkress/pic16f84sim/gui/SramTable.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package de.darkress.pic16f84sim.gui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
public class SramTable
|
||||
{
|
||||
private final int rows = 32;
|
||||
private final int columns = 8;
|
||||
private Object[][] data = new Object[rows][columns];
|
||||
|
||||
public JTable getTable()
|
||||
{
|
||||
return table;
|
||||
}
|
||||
|
||||
private JTable table = new JTable(data, createColumns());
|
||||
|
||||
public SramTable()
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < rows; i++) {
|
||||
for (int j = 0; j < columns; j++) {
|
||||
data[i][j] = Integer.toHexString(count).toUpperCase();
|
||||
table.getColumnModel().getColumn(j).setPreferredWidth(30);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Object[] createColumns(){
|
||||
Object[] columnNames = new Object[columns];
|
||||
for (int j = 0; j < columns; j++) {
|
||||
columnNames[j] = j;
|
||||
}
|
||||
return columnNames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void table() {
|
||||
// Create a scroll pane and add the table to it
|
||||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
|
||||
// Create a panel and add the scroll pane to it
|
||||
JPanel panel = new JPanel();
|
||||
panel.add(scrollPane);
|
||||
|
||||
// Create a frame and add the panel to it
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user