bundle.getparcelable java.lang.classnotfoundexception怎么解决
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bundle.getparcelable java.lang.classnotfoundexception怎么解决相关的知识,希望对你有一定的参考价值。
参考技术A java.lang.ClassNotFoundException:at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at com.view.MainFrame$1.valueChanged(MainFrame.java:133)
at javax.swing.JTree.fireValueChanged(JTree.java:2820)
at javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:3191)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelectionModel.java:629)
at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelectionModel.java:1078)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(DefaultTreeSelectionModel.java:287)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(DefaultTreeSelectionModel.java:170)
at javax.swing.JTree.setSelectionPath(JTree.java:1598)
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2311)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3524)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3463)
我写的反射:
final JTree tree = new JTree(root);
// leftPanel.add(tree);
// 树加到滚动面板中
scrollPane.setViewportView(tree);
tree.addTreeSelectionListener(new TreeSelectionListener() // 树的点击事件
public void valueChanged(TreeSelectionEvent e)
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
.getLastSelectedPathComponent();
if (node != null && node.isLeaf())
// JOptionPane.showMessageDialog(null, node.toString());//测试
String value = node.toString();
// 动态读取数据库的信息,来切换面板
AuthorityAction authorityAction = new AuthorityAction();
String url = authorityAction.selectByAname(value);
// 测试 JOptionPane.showMessageDialog(null, url);
// 反射,把字符串动态转换成类reflect
try
// 反射加载类
if (url.equals("") && url != null)
Class c = Class.forName(url);
// 实例化c类
Object obj = c.newInstance();
// 向下转型
JPanel panel = (JPanel) obj;
panel.setSize(rightPanel.getSize());
rightPanel.removeAll();// 移除原来的面板信息
rightPanel.add(panel);// 添加新的面板
rightPanel.repaint();// 刷新
catch (Exception ex)
ex.printStackTrace();
);
Java Math
Java Math类有许多方法可用于数学计算。
Math.max(x,y)
Math.max(x,y)
方法可以求出x, y中的最大值:
示例
Math.max(5, 10);
Math.min(x,y)
Math.min(x,y)
方法可以求出x, y中的最小值:
示例
Math.min(5, 10);
Math.sqrt(x)
Math.sqrt(x)
方法返回√x:
示例
Math.sqrt(64);
Math.abs(x)
Math.abs(x)
方法返回x的绝对值(正值):
示例
Math.abs(-4.7)
Math.random()
Math.random()
返回一个介于0(含)和1(不含)之间的随机数:
示例
Math.random();
Complete Math Reference
For a complete reference of Math methods, go to our Java Math Methods Reference.
The reference contains descriptions and examples of all math methods.
以上是关于bundle.getparcelable java.lang.classnotfoundexception怎么解决的主要内容,如果未能解决你的问题,请参考以下文章