我有一个模拟热图的按钮.当按钮点亮时,我使用setInterval函数
<button onclick="setInterval(function(){update_map()},50);">simulate</button>
Run Code Online (Sandbox Code Playgroud)
我的功能如下:
function update_map(){
counter+=50;
var i =1
for(i=counter-50;i<<?php echo json_encode($lat); ?>.length & i<counter;i++){
taxiData.push(new google.maps.LatLng(<?php echo json_encode($lat); ?>[i],<?php echo json_encode($log); ?>[i]));
}
var pointArray = new google.maps.MVCArray(taxiData);
heatmap = new google.maps.visualization.HeatmapLayer({
data: pointArray
});
heatmap.setMap(map);
if(i==<?php echo json_encode($lat); ?>.length )
clearInterval(setInterval(function(){update_map()},50));
}
Run Code Online (Sandbox Code Playgroud)
任何形式的帮助或建议将不胜感激.
我正在尝试做一个程序,如果两个TextFields等于某个值会发生什么,我有两个if语句.当第一个if语句发生时,第二个if语句发生但我在代码中设置的值不匹配.为了更好地解释,这里是代码:
private void LevelUp(){
float level = (float) Double.parseDouble(lvl.getText());
float expmn = (float) Double.parseDouble(ExpMin.getText());
if(level == 1 && expmn == 500){
lvl.setText("2");
ExpMin.setText("501");
ExpMax.setText("1000");
JOptionPane.showMessageDialog(null,"" + "levevlup!" ,"Para Yok",JOptionPane.PLAIN_MESSAGE);
if(level == 2 && expmn == 1000);
lvl.setText("3");
ExpMin.setText("1001");
ExpMax.setText("2500");
}
else{
JOptionPane.showMessageDialog(null,"" + "leveladssadaup" ,"Para Yok",JOptionPane.PLAIN_MESSAGE);
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在用一本书来学习java.我已经创建了一个Swing窗口,但是当我尝试创建JButton时,它们在运行时不可见.我完全按原样复制了代码,但它仍然不可见.这是代码:
import javax.swing.*;
class Buttons extends JFrame
{
JPanel pnl = new JPanel();
public Buttons()
{
super("Swing Window");
setSize(500,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
add(pnl);
setVisible(true);
pnl.add(new JButton("Click Me"));
}
public static void main(String[] args)
{
Window gui = new Window();
}
}
Run Code Online (Sandbox Code Playgroud) 在我的网站上,我想在用户登录时显示"注销"按钮,在用户未登录时显示注销按钮.
我写了这段代码:
if(isset($_SESSION["username"])){ echo "<li class='xy'><button class='x' onclick='location.href = 'index.php';'>Logout</button></li>"; } else { my login button... }
Run Code Online (Sandbox Code Playgroud)
按钮确实出现,但遗憾的是不可点击.
我怎么解决这个问题?
$('#mybutton').click(function () {
$('#id').text("this is my text " + "<br/>");
});
Run Code Online (Sandbox Code Playgroud)
这是我的jquery代码.单击按钮时mybutton,文本应更改为此.我现在的问题是<br/>标签不起作用.还有其他办法吗?谢谢.
btnAppShare即使按钮不可见,我也希望单击我的按钮,我在按钮1单击可见的监听器后编写了此代码.基本上,我希望在完全执行setOnClickListenerbutton1事件后,我的button2会自动被点击并执行其`setOnClickListener.
btnAppShare = (Button) findViewById(R.id.btnAppShare);
btnAppShare.setVisibility(View.INVISIBLE);
btnAppShare.performClick();
btnAppShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (TextUtils.isEmpty(regId)) {
Toast.makeText(getApplicationContext(), "RegId is empty!",
Toast.LENGTH_LONG).show();
} else {
Intent i = new Intent(getApplicationContext(),
MainActivity.class);
i.putExtra("regId", regId);
startActivity(i);
finish();
}
}
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试将图像添加到按钮(图像按钮或普通按钮),但不在特定的res / drawable文件夹中。
我希望将此图像作为ImageView对象或drawable对象等,但是我不能。
我有10个按钮,我想通过调用一个方法来初始化它们。我的意思是现在我有很多:
button= (Button) findViewById(R.id.button);
button1= (Button) findViewById(R.id.button1);
Run Code Online (Sandbox Code Playgroud)
我想要一个这样的方法,并在每次按钮初始化时调用它:
private void initialize(Button mybutton){
mybutton= (Button) findViewById(R.id.mybutton);
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Bunifu UI框架,一切都很好,直到我从Bunifu UI中添加了一个“退出”按钮,该按钮为bunifuFlatButton,我同时尝试了this.Close();。和Close(); 并与我都得到System.NullReferenceException是未处理的错误。
按键:
错误:
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Bunifu_UI_v1.5.3
StackTrace:
at Bunifu.Framework.UI.BunifuFlatButton.method_5()
at Bunifu.Framework.UI.BunifuFlatButton.BunifuFlatButton_MouseClick(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseClick(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Label.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) …Run Code Online (Sandbox Code Playgroud) button ×10
android ×3
java ×3
javascript ×2
bunifu ×1
c# ×1
findviewbyid ×1
html ×1
if-statement ×1
image ×1
javafx ×1
jbutton ×1
jquery ×1
jtextfield ×1
php ×1
setinterval ×1
swing ×1
text ×1
void ×1
winforms ×1