我正在尝试制作一个简单的计算器来练习图形(我是一个完整的GUI菜鸟).我在使用Polyashenkos校准器和文本区域以及文本区域和按钮之间的空间后有不必要的空间时遇到一些问题.另外,我如何保持这种布局,但消除空间,并使底部3按钮更小.关于我正在做什么或如何做得更好的任何提示将非常感激.谢谢.
import javax.swing.*;
import java.awt.*;
public class calculator {
public static void main(String[] args) {
// creates the JFrame(a window with decorations)
JFrame frame = new JFrame("Calculator");
// stops the program when window is closed
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(377, 350);
// the main panel of the JFrame,
// remembet you cant add content directly to JFrame
JPanel content = new JPanel(new GridLayout(4, 0));
// panel for the text field
JPanel textarea = new JPanel(new GridLayout(4, 0));
// panel for the buttons,
// …
Run Code Online (Sandbox Code Playgroud) 获取github
的bitbucket
信息库.
无法建立主机'github.com(some_ip_address)'的真实性.
这是我的部署文件.deploy:setup
并且deploy:check
工作得很好.
require "bundler/capistrano"
require "rvm/capistrano"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :repository, 'ssh://git@bitbucket.org/username/repo.git'
set :scm :git
set :scm_verbose, true
set :user, 'root'
set :deploy_via, :remote_cache
set :migrate_target, :current
set :branch, 'master'
set :application, 'my_app_name'
set :domain, 'my_domain_ip_address'
set :applicationdir, "/home/deploy/domains/#{application}"
set :deploy_to, "/home/deploy/domains/#{application}"
role :web, domain role :app, domain role :db, domain, :primary => true
set :keep_releases, 5
set :rvm_type, :system
after 'deploy:restart', 'deploy:cleanup'
namespace :deploy do
task :start …
Run Code Online (Sandbox Code Playgroud) deployment capistrano ruby-on-rails bitbucket rvm-capistrano
正如下面所述的错误消息,我不使用"user_profiles_path"作为复数,因为我在嵌套资源中定义了"resource:profile".
NoMethodError in Profiles#new
Run Code Online (Sandbox Code Playgroud)
显示/home/smileymike/rails_projects/bffmapp_v2/app/views/profiles/new.html.erb其中线#20提出:
undefined method `user_profiles_path' for #<#<Class:0x90266ac>:0xa041294>
Run Code Online (Sandbox Code Playgroud)
模型:
class User < ActiveRecord::Base
has_one :profile
class Profile < ActiveRecord::Base
attr_accessible :name, :surname
belongs_to :user
Run Code Online (Sandbox Code Playgroud)
routes.rb中:
resources :users do
resource :profile (note: has_one)
end
Run Code Online (Sandbox Code Playgroud)
查看:profiles/new.html.erb
<div class="row">
<div class="span6 offset3">
<%= form_for([@user, @profile]) do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :surname %>
<%= f.text_field :surname %>
<%= f.submit "Create my profile", class: "btn btn-large btn-primary" %>
<% end %>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
路线
user_profile …
Run Code Online (Sandbox Code Playgroud) controller ruby-on-rails form-for nested-resources ruby-on-rails-3
bitbucket ×1
calculator ×1
capistrano ×1
controller ×1
deployment ×1
form-for ×1
java ×1
jpanel ×1
swing ×1