-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInformation.java
More file actions
92 lines (79 loc) · 2.39 KB
/
Copy pathInformation.java
File metadata and controls
92 lines (79 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
public class Information extends JTabbedPane implements MouseListener
{
public int tabWidth = 0;
private int delCount = 0;
Popup popup;
/**
* Creates a new Tab for a Figure
*
* @param f The new Figure
*/
public void createTab(Figure f)
{
addMouseListener(this);
InfoPanel panel = new InfoPanel(this, f, "F"+(getTabCount()+1));
f.setTabValue(getTabCount());
panel.setPreferredSize(new Dimension(getWidth(), getHeight()));
addTab("F"+(getTabCount()+1), panel); // Second Param is possible icon
//setMnemonicAt(getTabCount(), KeyEvent.VK_1+getTabCount()); <-- This causes figures to disappear? I don't know.
updateTabs(f);
}
/**
* Deletes a specified tab for a Figure
*
* @param f The old Figure
*/
public void deleteTab(Figure f)
{
remove(f.getTabValue());
}
/**
* Updates all Figure tabs by setting the title and refreshing both lists
*/
public void updateTabs(Figure f)
{
updateFigure(f);
for(int i = 0; i < getTabCount(); i++)
{
setTitleAt(i, "Fig"+(i+1));
InfoPanel.toInfoPanel(getComponentAt(i)).refresh();
InfoPanel.toInfoPanel(getComponentAt(i)).refreshWatch();
}
}
public void updateFigure(Figure f)
{
Calculate calc = new Calculate(f);
calc.combineVariables();
for(Variable var : f.getVars())
{
if(!(var.isEnvironmental() || var.isConstant()))
{
String varName = var.getName().toString();
calc.setUnknownVariable(varName);
calc.solve();
}
}
}
/**
* Parses an object to an Information data type
*
* @param obj The non-Information object
* @return The Information version of the parameter
*/
public static Information parseInformation(Object obj)
{
return (Information)obj;
}
public void mouseExited(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mouseClicked(MouseEvent e)
{}
public void mousePressed(MouseEvent e){}
}