我正在练习MVC风格的编程.我在一个文件中有一个Mastermind游戏,工作正常(可能除了"Check"按钮在开始时不可见).
http://paste.pocoo.org/show/226726/
但是当我把它重写为模型,视图,控制器文件时 - 当我点击空Pin(应该更新,并重新绘制新颜色)时 - 注意到了.谁能在这里看到任何问题?我尝试在不同的地方放置repaint(),但它根本不起作用:/
主要:
public class Main {
public static void main(String[] args){
Model model = new Model();
View view = new View("Mastermind", 400, 590, model);
Controller controller = new Controller(model, view);
view.setVisible(true);
}
}
Run Code Online (Sandbox Code Playgroud)
型号:
import java.util.Random;
public class Model{
static final int
LINE = 5,
SCORE = 10, OPTIONS = 20;
Pin pins[][] = new Pin[21][LINE];
int combination[] = new int[LINE];
int curPin = 0;
int turn = 1;
Random generator = new Random(); …Run Code Online (Sandbox Code Playgroud) 刚刚开始学习一些python,我遇到了如下所述的问题:
a_file = open('E:\Python Win7-64-AMD 3.3\Test', encoding='utf-8')
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
a_file = open('E:\Python Win7-64-AMD 3.3\Test', encoding='utf-8')
PermissionError: [Errno 13] Permission denied: 'E:\\Python Win7-64-AMD 3.3\\Test\
Run Code Online (Sandbox Code Playgroud)
似乎是一个文件权限错误,如果任何人可以发光一些,将不胜感激.
注:不知道的Python和Windows文件是如何工作的,但我登录到Windows作为管理员和文件夹具有管理员权限.
我尝试更改.exe属性以管理员身份运行.
在android中使用对话框时可以取消它或解除它,但何时使用dismiss和何时使用取消?他们之间有什么区别?提前致谢.
我正在尝试使用MediaPlayer课程来播放视频文件.问题是视频根本没有显示,虽然我可以听到视频播放中的声音.
以下是活动代码
public class MainActivity extends Activity implements OnClickListener {
private SurfaceView surfaceView;
private Button btnPlay;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
addListener();
}
private void init() {
// TODO Auto-generated method stub
surfaceView = (SurfaceView) findViewById(R.id.surfaceView1);
btnPlay = (Button) findViewById(R.id.btnPlay);
}
private void addListener() {
// TODO Auto-generated method stub
btnPlay.setOnClickListener(this);
}
MediaPlayer mediaPlayer = null;
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.btnPlay:
try{
if …Run Code Online (Sandbox Code Playgroud) 基本上,Dialogs会在后台停用活动.因此DialogFragment复杂性增加也是如此.那么为什么要选择DialogFragment各种子类Dialog可用.
我一直在Netbeans IDE中运行不同的Java .java文件,方法是在Netbeans的Project Explorer中右键单击.java文件(通常位于Netbeans左上角的部分).
但是,我一直在谷歌搜索如何使用代码使类文件运行另一个类文件,但无济于事.
我有一个名为"loadanotherfile"的项目有2个文件,即:Loadanotherfile.java和otherfile.java
我正在尝试让Loadanotherfile.java运行otherfile.java,但我不确定如何.我读到了类加载器和URLClassloader,但是这些方法似乎不适合我运行另一个.java文件的目的.
下面是我提到的2个文件的代码.
Loadanotherfile.java
package loadanotherfile;
public class Loadanotherfile {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("Hello World!");
// TODO code application logic here
}
}
Run Code Online (Sandbox Code Playgroud)
otherfile.java
package loadanotherfile;
public class otherfile {
public static void main(String args[])
{
System.out.println("This is the other file.");
}
}
Run Code Online (Sandbox Code Playgroud)
我觉得这个任务与使用"import"语法有关(就像import loadanotherfile.* 但是即使我的猜测是正确的,我仍然不确定如何使我的Loadanotherfile.java运行其他文件.java使用代码.
如何使用Loadanothefile.java加载otherfile.java?
干杯
在developer.android.com上学习android片段时,指定不建议在两个片段之间直接通信.我想知道两个碎片之间的通信会失败的后果和后果是什么?
我有一个扩展BroadcastReceiver的类,只要有新的Wifi扫描结果可用就会被调用(接收器在清单中注册,并将Scan_Results广播作为intent-filter).
从这个课程,我希望能够向用户显示通知.目前,我将在广播意图类的onReceive方法中作为参数接收的上下文传递给另一个类的"show notification"方法.
当它到达该行:
myNotificationManager.notify(notificationId, notification);
Run Code Online (Sandbox Code Playgroud)
它失败,出现以下异常:
java.lang.IllegalArgumentException: contentView required: pkg=com.mumfordmedia.trackify id=2131034122 notification=Notification(vibrate=null,sound=null,defaults=0x0,flags=0x0)
Run Code Online (Sandbox Code Playgroud)
知道为什么会这样吗?我能想到的只是因为我从onReceive参数得到的上下文不是......因为没有更好的短语,"适合工作"......
有任何想法吗?谢谢,马克斯.
我使用hive-0.9.0与mysql作为metastore.我得到一个例外:
hive> show tables;
FAILED: Error in metadata: org.apache.thrift.transport.TTransportException:java.net.SocketTimeoutException:Read timed out
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
Error in metadata: MetaException(message:Could not connect to meta store using any of the URIs provided)
Run Code Online (Sandbox Code Playgroud)
任何指针都会有所帮助.
关心Neeraj
我正在使用oracle OIM 11g api(在oracle.iam包中).我使用类oracle.iam.platform.OIMClient来获取所有OIM客户端服务,如UserManager.
我需要找到配置工作流程获得的资源.我可以使用哪种服务?我该如何处理OIM api?